Subject: [xsl] 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 |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] splitting into multiple files, Helen Hye Kim | Thread | [xsl] Planning for a xml/xslt Websi, Geoff Hankerson |
[xsl] Re: getting the text nodes fr, Dimitre Novatchev | Date | RE: RE: [xsl] HTML Table, v . kavanagh |
Month |