Generating Form Inputs

H

HugeBob

Hi All,

I'm trying to create a form in my XSLT file and fill in the input tag
attributes with results from an XML transformation. Here's what I'm
doing that's not working:


<INPUT type="checkbox"

MSXSL reports: The character '<' cannot be used in an attribute value.

How can I perform this task correctly? Thanks.
 
J

Joe Kesselman

HugeBob said:
The character '<' cannot be used in an attribute value.

Either use the xsl:attribute directive to construct this attribute
(which can take arbitrarily complex code in its body to build up the
value), or look at the documentation for Attribute Value Templates.
 
J

Joe Kesselman

.... or retrieve the value into a variable and set the attribute's value
from that.

XSLT is a programming language; there are usually multiple ways to solve
any problem, and it's a partly matter of deciding which one best
expresses what you're trying to do.
 
H

HugeBob

Thanks Joe. AVT's worked out. Previously, I had tried using the
<xsl:attribute ...> tag to populate my <INPUT...>'s:

..
..
..
<TD ...>
<input type="checkbox" > <----------------- error
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@storyid"/>
</xsl:attribute>

But, my mistake was that I didn't terminate the input tag correctly: />

The processor reported: End tag 'TD' does not match the start tag
'input'. Needless to say, that confused me.
 
J

Johannes Koch

HugeBob said:
Thanks Joe. AVT's worked out.
Good

Previously, I had tried using the
<xsl:attribute ...> tag to populate my <INPUT...>'s:

..
..
..
<TD ...>
<input type="checkbox" > <----------------- error
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@storyid"/>
</xsl:attribute>

But, my mistake was that I didn't terminate the input tag correctly: />

No, you have to terminate the input element _after_ the xsl:attribute
elements:
<input ...>
<xsl:attribute ...>
...
</xsl:attribute>
<xsl:attribute ...>
...
</xsl:attribute>
</input>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top