[thelist] Generating html links with XSLT

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Wed Dec 28 11:58:51 CST 2005


Dave,

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

You're right.

Here is a good place to start and advance:

http://www.zvon.org/xxl/XSLTutorial/Output/index.html

...

XSLT is an XML file and it has to conform XML snytax.

in

presetRecall('<xsl

< indicates the start of a tag. However another tag has already started
(<a href="#") before and it has not ended yet. Thus it is a snytax
error as the parser indicates.

For a quick and dirty solution you may use:

<a href="#" onclick="presetRecall(this.childNodes[0].nodeValue)"><xsl:value-of
select="@name"/></a>

or

<a href="#" onclick="presetRecall(this.innerHTML)"><xsl:value-of
select="@name"/></a>

or

<a href="#" onclick="presetRecall(document.getElementById('label1').innerHTML)">Recall:
<label id="label1"><xsl:value-of
select="@name"/></label></a>

Both are quick suggestions and none of them is tested but
I hope you got the point.

I'm not sure but there may be more elegant ways of doing this. Buf if
there is a way I'm pretty sure it would be listed in an example at
zvon.org.


HTH,
--
Volkan Ozcelik
+>Yep! I'm blogging! : http://www.volkanozcelik.com/volkanozcelik/blog/
+> My projects/studies/trials/errors : http://www.sarmal.com/



More information about the thelist mailing list