[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: keyed lookup table

Subject: Re: keyed lookup table
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 17 Feb 2005 12:03:18 -0500
lookup table xslt 2.0
Kevin,

Are you using the key() function in its New Improved XSLT 2.0 version?

In XSLT 1.0, it won't take the third argument, and you have to change context to the stylesheet explicitly (probably by using a for-each) to get it to work the way you want.

But I'd expect, if that's the problem, you should be getting an error. If you're using XSLT 2.0 ... I'll let someone else address that, as the tools are new. (You should tell us which processor you're using, however.)

Cheers,
Wendell

At 11:44 AM 2/17/2005, you wrote:
I've got a working lookup table implemented like this:

<xsl:variable name="language-table">
  <!-- See ISO 639 -->
  <name code="ar">ARABIC</name>
  <name code="de">GERMAN</name>
  <name code="en">ENGLISH</name>
...
  <name code="zh">CHINESE</name>
</xsl:variable>

that I can access in my templates with an expression like:

$language-table/name[@code='de']

I was hoping I could access that table via a key:

<xsl:key name="language-code" match="name" use="@code"/>

that I would access with this expression:

key('language-code', 'de', $stylesheet)"/>

given:

<xsl:variable name="stylesheet" select="document('')"/>

But the key function always returns an empty sequence.  Why?  Can I use
a key on these $language-table/name nodes, which are internal to the
stylesheet?  (I'm sure it will work if I move the lookup table from the
stylesheet to its own external XML document, which is more maintainable
anyway, but I want to udnerstand what is wrong with the idea of a keyed
lookup table within the stylesheet.)



====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.