Re: [xsl] value-of node test.

Subject: Re: [xsl] value-of node test.
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 10 Jul 2006 16:22:38 -0400
Steve,

At 03:12 PM 7/10/2006, you wrote:
I'm iterating thu an ordered list of services.

I have another list of the values of those services, but not in order.

As I move thru the ordered list, I'd like to get the value of the
unordered list which shares meets the service=@title test.

Is there a shorthand way to do this using value-of? I know I can
resort to xsl:when or xsl:if, if need be.

If the two lists of values are in the same document, you may simply need the current() function:


<xsl:value-of select="$services//Record[service = current()/@title ]/value" />

If one of the lists has to be provided by the stylesheet, see the "lookup tables" idiom as documented on the XSLT FAQ at:

http://www.dpawson.co.uk/xsl/sect2/N4995.html

Note that the table itself can be stored either in an external file, or in the stylesheet itself, accessed via a call to document('') (which returns the XML of the stylesheet parsed as a document).

Cheers,
Wendell

Current Thread