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

Re: splitting into multiple files and using a lookup x

Subject: Re: splitting into multiple files and using a lookup xsl:key to generate filename
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 4 Sep 2003 22:07:22 +0200
helen hye kim
> XSLT fragment:
>
> !--Set up a variable to hold contents of the counties.xml lookup -->
> <xsl:variable name="countyLookup-top"
> select="document('counties.xml')/counties"/>
>
> <!--define key-->
> <xsl:key name="countyLookup" match="name" use="num" />
>
> <xsl:template match="/">
> <xsl:apply-templates select="key('countyLookup', 'Alpine')" />
> </xsl:template>

There is no "name" element in the source xml doc.  (bigFile.xml)

Therefore, you must probably have something like this, in order to make
'counties.xml' the current document:

<xsl:template match="/">
  <xsl:for-each select="document('counties.xml')">
    <xsl:apply-templates select="key('countyLookup', 'Alpine')" />
  </xsl:for-each>
</xsl:template>


The above xsl:for-each has a "select" attribute with a nod-set of only one
node -- the root node of 'counties.xml'. Its purpose is to make
'counties.xml' the current document.

>
> <xsl:template match="name">
> <xsl:variable name="countyNo">
> <xsl:value-of select="." />
> </xsl:variable>
> </xsl:template>

If you want a number, you must reference the "num" sibling of the current
node. Thus, you have to define the variable in this way:

   <xsl:variable name="countyNo" select="../num"/>


In the list archives there are good example of using an lookup table.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.