Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOWTO: xform attribute with no value?

Status
Not open for further replies.

codestorm

Programmer
Apr 11, 2001
504
AU
The XSL (snippet)
<input type=&quot;radio&quot;>
<xsl:attribute name=&quot;name&quot;>
<xsl:text>Rating</xsl:text>
<xsl:value-of select=&quot;$currentnodeid&quot; />
</xsl:attribute>
<xsl:attribute name=&quot;value&quot;>
<xsl:value-of select=&quot;substring-after(@name, 'Rating')&quot; />
</xsl:attribute>
<xsl:if test=&quot;/root/text[@name=concat('Rated', $currentnodeid)]/text() = substring-after(@name, 'Rating')&quot;>
<xsl:attribute name=&quot;selected&quot; />
</xsl:if>
</input>

Now, I'd /like/ the output to be something like:

<input name=&quot;Rating123&quot; value=&quot;1&quot;>

or

<input name=&quot;Rating123&quot; value=&quot;1&quot; selected>

However, I'm having trouble with the &quot;selected&quot; bit. The above XSL generates:

<input name=&quot;Rating123&quot; value=&quot;1&quot; selected=&quot;&quot;>

which the browser doesn't accept. How to add an attribute without a corresponding value?

PS I've tried putting the &quot;selected&quot; 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>
 
Doh! Never mind, I'll just slap myself about a bit.

It should be checked, not selected - and then the browser accept it, even as checked=&quot;&quot;.

/sigh/

codestorm
Newbie Life Member.
Fire bad. Tree pretty. - Buffy
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top