[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] lookup table


Subject: Re: [xsl] lookup table
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 23 Jul 2002 20:18:32 +0200

> 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




Current Thread
Keywords
xsl