[thelist] XSLT Attributes and Variable name
David.Cantrell at Gunter.AF.mil
David.Cantrell at Gunter.AF.mil
Thu Jan 16 11:16:28 CST 2003
>Right, in the honourable tradition of replying to your own post, I've
>just worked out how to do this:
Glad I could help. ;)
><xsl:template match="reference">
> <a><xsl:attribute name="href"><xsl:value-of select="//target[@name =
>current()/@refname]/@refuri"/></xsl:attribute><xsl:apply-templates
>/></a>
></xsl:template>
Actually, you should be able to shorten this up just a bit:
<xsl:template match="references">
<a
href="{//target[@name=current()/@refname]/@refuri}"><xsl:apply-templates
select="."/></a>
</xsl:template>
The "{xpath-expression}" syntax within an attribute value is a shortcut for
the parser and avoids you having to manually build the output element tree
yourself. See http://www.w3.org/TR/xslt#dt-attribute-value-template for
more details.
HTH,
-dave
More information about the thelist
mailing list