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

for-each over variable problem

Subject: for-each over variable problem
From: Jakub.Valenta@xxxxxxxx
Date: Mon, 4 Feb 2002 15:46:30 +0200
foreach in variable
Hi all,
I am trying to iterate over a variable using for-each, and I am getting
errors with majority of parsers :-(.
The only one working is Sablotron (I am using cooktop, to test which engine
works).

the style sheet looks like

<xsl:stylesheet version="1.0" xmlns:xsl
="http://www.w3.org/1999/XSL/Transform">


   <!-- VARIABLE -->

   <xsl:variable name="Modules">
      <module>InternalCS</module>
      <module>FileCS</module>
   </xsl:variable>

   <xsl:template match="wrapper">
      <xsl:for-each select="event">
         <xsl:call-template name="event" />
      </xsl:for-each>
   </xsl:template>


  <!-- THE PROBLEMATIC FOR-EACH -->

   <xsl:template name="event">
   <xsl:for-each select="$Modules/module">module</xsl:for-each>
   </xsl:template>

</xsl:stylesheet>

and the input is

<wrapper>
 <event>1</event>
 <event>2</event>
 <event>3</event>
..
</wrapper>

In Michael Kay's book is example like this on p.343, but id does not work
here. Any idea why?

I usually get error like " Reference to variable or parameter 'Modules'
must evaluate to a node list."

br,

Jakub


 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.