Re: Re: [xsl] Re: WML input problem

Subject: Re: Re: [xsl] Re: WML input problem
From: "ashu t" <aashut@xxxxxxxxxxxxxx>
Date: 15 Jul 2002 09:31:10 -0000
Thanks Joerg
i do not have any control over the input html file it can be any html page from the web.then i am using tidy to convert them in well formed xhtml .and then applying stylesheet to convert them in wml.
and the page has this input
<form method="POST" action="urlToInvoke">
<p>Specify your music preferences (check all that apply):</p>


<p><input type="checkbox" name="musicpref_rnb"
checked="checked" />R&amp;B<br />
<input type="checkbox" name="musicpref_jazz"
checked="checked" />Jazz<br />
<input type="checkbox" name="musicpref_blues" />Blues<br />
<input type="checkbox" name="musicpref_newage" />New Age</p>

<p>Choose a Category of Room:</p>

<div style="margin-left: 2em"><input type="radio" name="category"
value="liv" checked="checked" /> Living<br />
<input type="radio" name="category" value="din" /> Dining<br />
<input type="radio" name="category" value="bed" /> Bedroom</div>
</form>
and the form of out put which is desired is


Specify your music preferences (check all that apply):
<select ivalue="1" multiple="true" name="musicpref_rnb">
<option value="">
R&amp;B
</option>
</select>
<br/>
<select ivalue="1" multiple="true" name="musicpref_jazz">
<option value="">
Jazz
</option>
</select>
<br/>
<select multiple="true" name="musicpref_blues">
<option value="">
Blues
</option>
</select>
<br/>
<select multiple="true" name="musicpref_newage">
<option value="">
New Age
</option>
</select>

Choose a Category of Room:

<select ivalue="1" name="category">
<option value="liv">
Living
</option>
<option value="din">
Dining
</option>
<option value="bed">
Bedroom
</option>
</select>
<do label="submit" type="accept">
<go href="urlToInvoke" method="post">
<postfield name="musicpref_rnb" value="$musicpref_rnb"/>
<postfield name="musicpref_jazz" value="$musicpref_jazz"/>
<postfield name="musicpref_blues" value="$musicpref_blues"/>
<postfield name="musicpref_newage" value="$musicpref_newage"/>
<postfield name="category" value="$category"/>
</go>
</do>
i tried simply text() and <xsl:apply-templates select="*"/> but nothing is working .following sibling is giving text between <option> and </option> .
and for getting the complete output i tried this in form (only for checkbox as i could not get how to do for radio) but it is not working and giving error.


<xsl:template match="p/form | div/form | center/form | a/form | table/form | tr/form | td/form | th/form | select/form | ul/form | li/form">
xsl:for-each select="input[@type='checkbox']">
<do label="submit" type="accept">
<go href=urlToInvoke" method="{@method}>
<postfield name="{@name}" value="{@value}">
</go>
</do>
<xsl:apply-templates/>
</xsl:template>


so i do not have any control over html input all i can do is write a generic stylesheet but not getting it correctly .
please help me
ashu





















On Sat, 13 Jul 2002 Joerg Heinicke wrote :
ashu t wrote:
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()"/>

Why following-sibling?? Either you changed your XML or you should use simply "text()". For me it looks, that you have a structure like


<form>
  <input/>
  text
  <input/>
  text
</form>

Because of this you can access the text via following-sibling and the text gets outputted via the <xsl:apply-templates/> in the match on <form>. Either you change the XML to <input>text</input> or you change the apply-templates to <xsl:apply-templates select="*"/>.

Hope this solves your problem,

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



Current Thread