Re: [xsl] Re: WML input problem

Subject: Re: [xsl] Re: WML input problem
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Mon, 15 Jul 2002 21:29:50 +0200
I thought I provided the solution (despite the "new" HTML-structure) in the last mail.

At the <option> element you have to use the <xsl:value-of select="following-sibling::text()[1]"/>. But at the template matching on any kind of form, you must not use <xsl:apply-templates/> but <xsl:apply-templates select="*"/>. This should solve the problem of doubled text output.

But a comment: If the stylesheet shell work on "any" website, you will get problems I think. In your example it's written

<input/>text<br/>

while I would write

<input>text</input><br/>

So you will have to implement some logic for it.

Regards,

Joerg

ashu t wrote:
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



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread