|
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:variable>
<xsl:template match="dictionary">
<xsl:value-of select="$table/entry[@code=current()/@lookup]/@value"/>
</xsl:template>
Needs the xx:node-set() extension or the document("") cheat if using XSLT
1.0.
Michael Kay
http://www.saxonica.com/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] mixed content nodes quest, Mark Lundquist | Thread | RE: [xsl] mixed content nodes quest, Mark Lundquist |
| Re: [xsl] mixed content nodes quest, António Mota | Date | RE: [xsl] mixed content nodes quest, Mark Lundquist |
| Month |