Re: Re: [xsl] Doubled output of text nodes

Subject: Re: Re: [xsl] Doubled output of text nodes
From: "ashu t" <aashut@xxxxxxxxxxxxxx>
Date: 12 Jul 2002 04:48:21 -0000
could you please give the solution what you have found in the book as i have the same problem of doubled output
i have a html file which has
<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>


when i am using this style sheet
<xsl:template match="font/input | form/input | td/input | p/input | div/input | center/input | table/input">
<xsl:choose>
<xsl:when test="@type='text' or @type='password'">
<input name="{@name}" type="{@type}">
<xsl:apply-templates/>
</input>
</xsl:when>
<xsl:when test="@type='radio' and count( . | key('radios', @name)[1] ) = 1">
<select name="{@name}">


          <xsl:for-each select="key('radios', @name)">
              <option value="{@value}">
             <xsl:value-of select="following-sibling::text()"/>
            </option>
           </xsl:for-each>
        </select>
     </xsl:when>

     <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>

    </xsl:choose>
  </xsl:template>

<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:apply-templates/>
</xsl:template>


it is producing out put like this
<p>
Specify your music preferences (check all that apply):

<select name="musicpref_rnb" multiple="true" ivalue="1"><option value="">R&amp;B</option></select>R&amp;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
</p>
but i need output only between <option>and </option>
may be it is being processed two times one by code in tempplate match ="input" and one by <apply-templates> in template match="form" if i remove this line
<xsl:value-of select="following-sibling::text()"/>
text is not coming between <option> and </option> which is required
can you help me
ashu
_________________________________________________________
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