This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: lookup table
> select="document('')/*/data:definitions/term[@name = name()]"
Both @name and name() refer to the term element, so it's true for:
<term name="term"/>
What you probably want is "term[@name = current()/name()]".
Regards,
Joerg
Guy McArthur wrote:
Can I have a static lookup table *inside* my xsl stylesheet?
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:data="urn:some.urn"
exclude-result-prefixes="data">
<data:definitions>
<term name="gmt">Greenwich Mean Time</term>
<term name="mst">Mountain Standard Time</term>
</data:definitions>
<xsl:template>
<xsl:value-of select="document('')/*/data:definitions[@name='gmt']"/>
</xsl:template>
...
What I'm doing is
select="document('')/*/data:definitions/term[@name = name()]"
(where the attribute matches the node name).
The input is like:
<times>
<mst>some time value</mst>
<utc>another time value</utc>
</times>
But it doesn't work! Everything else is as you suggested.
Are @name and name() comparable as strings?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list