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

RE: [xsl] mixed content nodes question

Subject: RE: [xsl] mixed content nodes question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 7 Jan 2005 19:48:53 -0000

> > Or to one who doesn't like if's
> >
> ><xsl:template match="dictionary[lookup = '3']>Foo<xsl:/template>
> ><xsl:template match="dictionary[lookup = '4']>Foo<xsl:/template>

My preferred way to do lookups is to make it table driven:

<xsl:variable name="table">
  <entry code="3" value="foo"/>
  <entry code="4" value="bar"/>

<xsl:template match="dictionary">
  <xsl:value-of select="$table/entry[@code=current()/@lookup]/@value"/>

Needs the xx:node-set() extension or the document("") cheat if using XSLT

Michael Kay

Current Thread