|
[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
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








