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

Re: XSL resources - Flat to hierarchy - Common ancesto

Subject: Re: XSL resources - Flat to hierarchy - Common ancestors
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 27 Jul 2004 11:08:08 +0100
flat globe
<xsl:for-each select="msxsl:node-set($menus)">

node-set always makes a set containing _one_ element only so this
for-each isn't going to iterate very much.

The result tree fragment made by
  <xsl:variable name="menus">
	<xsl:apply-templates select="Menus"/>
  </xsl:variable>	
has a single top level node / (like an input document) and below that it
has whatever elements are made by applying templates to Menus
so when that is made into a node set you get a set consisting of a
single / node.


If you apply templates to that, then the template that matches will be
this one:

<xsl:template match="/">
  <xsl:variable name="menus">
	<xsl:apply-templates select="Menus"/>
  </xsl:variable>	
  <xsl:for-each select="msxsl:node-set($menus)">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:attribute name="TOC">
        <xsl:number level="multiple" format="1.1"/>
      </xsl:attribute>  
    </xsl:copy>
  </xsl:for-each>  
</xsl:template>

and you'll go into an infinite loop and die.

So instead do

 <xsl:for-each select="msxsl:node-set($menus)/*">
                                             ^^^

so you apply templates to the elements  below / not to the / node.


I doubt that there is anyone on this list who's used node-set before who
hasn't made this mistake at least once (except Jeni of course:-)
I've done it thousands of times...


David



________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.