[thelist] XSLT Attributes and Variable name

seb potter seb at members.evolt.org
Wed Jan 15 11:14:05 CST 2003


Hi all

I have the following snippet of XML:

<reference name="site">some text</reference>
... stuff ...
<target id="site" refuri="http://www.blah.com" />

What I want to be able to do is use the following transform:

<xsl:template match="//target">
<xsl:variable name="@id"><xsl:value-of select="@refuri"
/></xsl:variable>
</xsl:template>

in the top-level of the stylesheet, and at a lower level:

<xsl:template match="reference">
<a href="{@refname}"><xsl:apply-templates/></a>
</xsl:template>

Where @refname in the <a> tag will evaluate to the top-level variable
created earlier, such that the refname attribute of the <reference> tag
is replaced by the value of the variable with the corresponding name
attribute.

Anybody got any ideas?

- seb

--
seb potter <seb at getfrank.com>
Getfrank Ltd
--
seb potter - seb at poked.org
http://poked.org - It's what you value.



More information about the thelist mailing list