xsl-list
[Top] [All Lists]

Re: [xsl] Lookup tables

2007-03-15 19:06:39
James A. Robinson wrote:
Oh, I see I misread your post. I thought you wanted to put the
table in the stylesheet, sorry.  Can't you just use a normal
key lookup?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:myns="uri.my.namespace"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:output method="text" />

  <xsl:key name="Keys" match="Keys/Key" use="@name" />
<xsl:template match="/">
    <xsl:apply-templates select="/A/B/C/*"/>
  </xsl:template>
<xsl:template match="Referrer">
    <xsl:value-of select="key('Keys', @ref)/@value"/>
  </xsl:template>

</xsl:stylesheet>

OK, I think I misunderstood how keys work. So the template says match Keys/key, does that mean match Keys/key anywhere or from the root?

Cheers.

--
Kamal Bhatt


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>