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

Re: looping through Elements stored in a variable..

Subject: Re: looping through Elements stored in a variable..
From: Niko Matsakis <niko@xxxxxxxxxxxxx>
Date: Mon, 18 Nov 2002 12:36:29 -0500
looping through a variable
One way to do this would be something like the following:

<xsl:stylesheet xmlns:me="http://www.my-namespace.com">
<me:University-List>
<University id = "1"> University1</University>
<University id = "2"> University2</University>
<University id = "3"> University3</University>
<University id = "4"> University4</University>
</me:University-List >
<xsl:template match="/">
<xsl:variable name="univ-var" select="document("")/xsl:stylesheet/me:University-List"/>
<xsl:for-each select="$univ-var/University">
<!-- do something -->
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


i.e., use the document function to load the source xml of your stylesheet and access the data without using an RTF. This only works, of course, if your RTF is constant. I'm using the namespace "www.my-namespace.com" as an example, obviously, any namespace that is not the XSLT namespace should be okay.


Niko Matsakis DataPower technology


Laura Jenkins wrote:


Hello people,
i have the following xsl structure

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
 <xsl:variable name="univ-var">
  <University-List>
   <University id = "1"> University1</University>
   <University id = "2"> University2</University>
   <University id = "3"> University3</University>
   <University id = "4"> University4</University>
  </University-List >
 </xsl:variable>
<!-- i want to iterate through this variable without usiing the extension
nodeset..-->
<!-- something along the lines of .. -->
 <xsl:for-each select="$place-var/placements/placement">
 <xsl:value-of select="."/>
 </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

What i was doing obviousl;y does not work because it needs to be a nodeset.
Can any one tell me how to do this without using the extension : nodeset.
Its is  MANDATORY that I  DO NOT USE the extension nodeset.
Thanks


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list







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.