[thelist] Generating html links with XSLT

Dave Merrill dmerrill at usa.net
Wed Dec 28 09:49:15 CST 2005

Hi folks, XSLT newb here...

I'm generating html using xslt. This much is working fine:
<a href="#" onclick="presetRecall('*')">Recall: <xsl:value-of

What I actually want though, is for the asterisk between the quotes in the
onclick function to instead be the <xsl:value-of> expression I've put in the
link text, like this:
<a href="#" onclick="presetRecall('<xsl:value-of

The expression is valid, and displays correctly in the link text, but in the
second version, I get this error:
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: Use
"&lt;" for "<" in attribute values.

Even though it didn't seem like the issue, I've tried many combinations of
single, double, and entity-fied quotes at various levels, no difference.
Using #x60; and #x62; for < and > in the <a> tags prevents the error, but of
course displays like the html source, not an actual link.

It seems that the XLT parser considers onclick to be an attribute of the <a>
element (it is), and isn't happy with un-escaped "<" chars in what it thinks
is literal attribute text. How can I use my dynamic xslt expression here, or
generate the same effect?

Thanks much,

Dave Merrill

More information about the thelist mailing list