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

Problem with keys in for-each (?)

Subject: Problem with keys in for-each (?)
From: Don Bruey <dbruey@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Mar 2001 14:10:23 -0500
for each loop saxon key
In the following XSLT, I have a key() function called to look up a specific
element in the key.  If I call this alone, as it is in the first line of the
template for "/", it works and I get the output I expect.  If I do the EXACT
same thing within the loop, I get no output as a result of the
apply-templates. The for-each loop is getting executed the appropriate
number of times.  The results are the same for MSXML3 and Saxon.  Any ideas?


<?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" 
                xmlns:xbrl="http://www.xbrl.org/core/2000-07-31/metamodel" 
                xmlns:xsd ="http://www.w3.org/1999/XMLSchema">

<xsl:variable name="taxonomy" select="document('AlteredTaxonomy.xml')" />

<xsl:key name="itemKey" match="//*[local-name() = 'item']" 
			use="ancestor-or-self::*[@type][1]/@type" />

<xsl:template match="/"> 
  <!-- this apply-templates call works fine and calls the template below
correctly -->
  <xsl:apply-templates select="key('itemKey',
'ci:entityInformation.businessDescription')" />

  <xsl:for-each select="$taxonomy//element" >
    <!-- xsl:number does output something the number of times I would
expect, 
		so I know this loop is getting executed -->
    <xsl:number /><BR/>

    <!-- nothing is generated by this call this time - 	
		it's exactly the same as the above apply-templates call...
Why? -->
    <xsl:apply-templates select="key('itemKey',
'ci:entityInformation.businessDescription')" />   

  </xsl:for-each> 

</xsl:template>

<xsl:template match="*">
  do something here
</xsl:template>

I want to create a variable within the for-each loop with the correct key
and
look that up - but since I can't get past this issue, I can't use the
variable as the key either,
which is why this bizarre hardcoded XSLT is what I currently am working
with. 

Thanks. 

Don





 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.