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

Re: node-set = node-set involving variable fails

Subject: Re: node-set = node-set involving variable fails
From: David N Bertoni/Cambridge/IBM <david_n_bertoni@xxxxxxxxxx>
Date: Fri, 8 Nov 2002 15:08:18 -0800
xsl nodeset with variable



Roger Glover <glover_roger@xxxxxxxxx> wrote:
> I discovered the "nodeset()" extension function in Xalan, so now my joy
is
> complete, even though my XSLT Recommendation compliance is not.

You can have your cake and eat it too by replacing xsl:variable with some
regular elements:

   <?xml version="1.0"?>
   <xsl:stylesheet
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:foo="http://myURI.foo.com"
     exclude-result-prefixes="foo"
     version="1.0">

   <foo:var name="targets">
       <target>target1</target>
       <target>target2</target>
           <!-- ...... -->
       <target>target93</target>
   </foo:var>

   <xsl:variable name="targets"
       select="document('')/*/foo:var[@name = 'targets']"/>

   <xsl:template match="/">
     <out>
       <xsl:for-each select="$targets/*">
         <xsl:text>&#xA;</xsl:text>
         <target>
            <xsl:value-of select="."/>
         </target>
       </xsl:for-each>
       <xsl:text>&#xA;</xsl:text>
     </out>
   </xsl:template>

   </xsl:stylesheet>

The xsl:for-each is there just to demonstrate that the variable is really a
node-set.

Not tested, but you get the idea! ;-)

Dave


 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.