The XSL (snippet)
<input type="radio">
<xsl:attribute name="name">
<xsl:text>Rating</xsl:text>
<xsl:value-of select="$currentnodeid" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="substring-after(@name, 'Rating')" />
</xsl:attribute>
<xsl:if test="/root/text[@name=concat('Rated', $currentnodeid)]/text() = substring-after(@name, 'Rating')">
<xsl:attribute name="selected" />
</xsl:if>
</input>
Now, I'd /like/ the output to be something like:
<input name="Rating123" value="1">
or
<input name="Rating123" value="1" selected>
However, I'm having trouble with the "selected" bit. The above XSL generates:
<input name="Rating123" value="1" selected="">
which the browser doesn't accept. How to add an attribute without a corresponding value?
PS I've tried putting the "selected" test outside everything else (as an xsl:choose) - it seems that the XSL parser doesn't like attributes without values.
codestorm
Newbie Life Member.
Fire bad. Tree pretty. - Buffy
<insert witticism here>
<input type="radio">
<xsl:attribute name="name">
<xsl:text>Rating</xsl:text>
<xsl:value-of select="$currentnodeid" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="substring-after(@name, 'Rating')" />
</xsl:attribute>
<xsl:if test="/root/text[@name=concat('Rated', $currentnodeid)]/text() = substring-after(@name, 'Rating')">
<xsl:attribute name="selected" />
</xsl:if>
</input>
Now, I'd /like/ the output to be something like:
<input name="Rating123" value="1">
or
<input name="Rating123" value="1" selected>
However, I'm having trouble with the "selected" bit. The above XSL generates:
<input name="Rating123" value="1" selected="">
which the browser doesn't accept. How to add an attribute without a corresponding value?
PS I've tried putting the "selected" test outside everything else (as an xsl:choose) - it seems that the XSL parser doesn't like attributes without values.
codestorm
Newbie Life Member.
Fire bad. Tree pretty. - Buffy
<insert witticism here>