XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
k jSubject: node-set - Arrays in XSLT?
Author: k j
Date: 24 Mar 2006 06:32 AM
Hi all,

I want to be able to parse an XML doc and store the results in a DataStructure so I can later iterate over this e.g. Array...I read that XSLT doesnt support Arrays but theres the node-set which will let me do this looping over a subset of the xml stored in the node-set structure?

Can someone give me an example or inform me if theres any other DataStructures that would be suitable for this?


Minollo I.Subject: node-set - Arrays in XSLT?
Author: Minollo I.
Date: 24 Mar 2006 09:31 AM
If you use the "books.xml" file shipped as part of the example Stylus Studio project, you can, as an example, do something like this:

<xsl:template match="/">
<!-- collect all books satisfying some condition in a variable -->
<xsl:variable name="myBooks">
<xsl:for-each select="books/book[@bookid &lt; 3]">
<xsl:copy-of select="."/>

<!-- output the title of the first book referenced by the variable -->
<xsl:value-of select="$myBooks[1]/book/title"/>

Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.