This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: Re: WML input problem
- From: "ashu t" <aashut at rediffmail dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: 12 Jul 2002 08:58:34 -0000
- Subject: Re: Re: [xsl] Re: WML input problem
- Reply-to: xsl-list at lists dot mulberrytech dot com
thanks Joerg
i have tried this to print text between <option> and </option>
<xsl:when test="@type='checkbox'">
<select name="{@name}" multiple="true">
<xsl:if test="@checked='checked'">
<xsl:attribute name="ivalue">1</xsl:attribute>
</xsl:if>
<option value="{@value}">
<xsl:value-of select="following-sibling::text()"/>
</option>
</select>
</xsl:when>
though it is giving text between <option> and </option>
but it is producing the same text after the </select> which is not
required.
Specify your music preferences (check all that apply):
<select name="musicpref_rnb" multiple="true" ivalue="1"><option
value="">R&B</option></select>R&B<br/>
<select name="musicpref_jazz" multiple="true" ivalue="1"><option
value="">Jazz</option></select>Jazz<br/>
<select name="musicpref_blues" multiple="true"><option
value="">Blues</option></select>Blues<br/>
<select name="musicpref_newage" multiple="true"><option
value="">New Age</option></select>New Age
Choose a Category of Room:
<select name="category"><option value="liv">
Living</option><option value="din"> Dining</option><option
value="bed"> Bedroom</option></select> Living<br/>
Dining<br/>
Bedroom
may be this is because the <input> is inside <form>
and i have code
<xsl:template match="p/form | div/form | center/form | table/form
| tr/form | td/form | th/form | select/form">
<xsl:apply-templates/>
</xsl:template>
for processing childs of <form> so this is also putting text in
output .
how can that be prevented
and as for the problem of html in which text was not coming in
output if it is not inside any tag but the body i tried this
<xsl:template match="body/text()">
<p><xsl:value-of select="."/></p>
</xsl:template>
it is giving correct output .
i guess i did it correctly
but not able to solve that input problem producing text twice
can you help me.
ashu
On Wed, 10 Jul 2002 Joerg Heinicke wrote :
Did you test the code as it is from
http://sources.redhat.com/ml/xsl-list/2002-07/msg00464.html? Do
you have any possibility to compare the output of Sablotron with
the output of another processor, e.g. at least with MSXML in IE
(http://msdn.microsoft.com/downloads/sample.asp?url=/msdn-files/027/000/543/msdncompositedoc.xml&frame=true)
or Transformiix in Mozilla (DOM Inspector)?
Especially the output of the text after the <option/> elements is
really strange. Is Sablotron so buggy?
should i used some thing else except <xsl:apply-templates> in
between<option> and </option> and
No, it should work. <xsl:apply-templates/> is the same as
<xsl:apply-templates select="node()"/> and node() consists of
elements, text nodes, comments and processing instructions. So I
don't understand why it should not work.
i have changed the key for checkbox like
<xsl:key name="checkboxes" match="input[@type='checkbox']"
use="@type"/>
because i think i can not use name it can be any thing in case
of checkbox.though it is working but is it right?
Using it with my code/Muenchian Grouping it's definitely wrong.
You will group the input elements which have @type='checkbox' by
their @type - so all of them will be in one group. Because of
your input
<input type="checkbox" name="musicpref_rnb"
checked="checked">R&B</input>
<input type="checkbox" name="musicpref_jazz"
checked="checked">Jazz</input>
<input type="checkbox" name="musicpref_blues"
checked="checked">Blues</input><br/>
<input type="checkbox" name="musicpref_newage" checked="checked">
New Age</input>
I grouped them by the first part of @name (all with 'musicpref_'
in one group). If you want to group them in a different way, e.g.
all in one <p> or something similar, you have to change the @use
of the key and in the same way the second parameter of
key('checkboxes', ...).
and if i have a very simple html like
<html><head><title>simple</title></head>
<body>some text</body>
</html>
and if in style sheet i write
<xsl:template match="body">
<xsl:apply-templates/>
</xsl:template>
it is not giving output as *some text *
is there any different template rule for outputting plain
text.
i thought <xsl:apply-templates/> will automatically put text in
output tree and process other nodes
because in my html if some text is not enclose in between any
tag and it is just in side of <body> it is not working but if i
enclosed it in any tag for example <p> and </p> it is coming in
output.
Again: <xsl:apply-templates/> tries to apply templates for all
child nodes of the current node. In your short example you only
have a text node as child of the body element, which you will see
in the output, because of a built-in template similar to the
following:
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
For more information on built-in templates look at
http://www.dpawson.co.uk/xsl/sect2/defaultrule.html.
I hope I could help you a bit. Try to compare Sablotron's output
with some other processor's output. You will at least have on of
those both browsers on your machine, won't you?
Regards,
Joerg
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________
There is always a better job for you at Monsterindia.com.
Go now http://monsterindia.rediff.com/jobs
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list