[thelist] XSLT Attributes and Variable name

seb potter seb at members.evolt.org
Thu Jan 16 03:15:00 CST 2003


On Thu, 2003-01-16 at 08:53, seb potter wrote:
> Hi Dave, thanks for answering.
>
> Here's the XML that I've got. I have no control over this bit:
>
> <document>
> 	<paragraph>here is a link to a website - <reference
> refname="website">Some text</reference>, and there's some more text
> here.</paragraph>
> 	<target id="website" name="website" refuri="http://www.somesite.com" />
> 	<paragraph>here is a link to another website - <reference
> refname="anotherlink">Some different text</reference>, and some more
> junk text here.</paragraph>
> 	<target id="anothersite" name="anothersite"
> refuri="http://www.mysite.com" />
> </document>
>

Right, in the honourable tradition of replying to your own post, I've
just worked out how to do this:

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


- seb


--
seb potter - seb at poked.org
http://poked.org - It's what you value.



More information about the thelist mailing list