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

Re: How to create a temporary xml tree and then re-use

Subject: Re: How to create a temporary xml tree and then re-use it
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Tue, 22 Jan 2002 22:03:59 +0100
temporary xml
You can do it like the following:

<xsl:variable name="$qty">
    <load-qty>12</load-qty>
    <load-qty>2</load-qty>
    <load-qty>53</load-qty>
</xsl:variable>

The problem is that you don't have a nodeset now, only a Result Tree
Fragment. And on the RTF you can't work like on a nodeset. You need a
nodeset()-function, but it is processor-specific. An example for Xalan:

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

<xsl:variable name="$qty">
    <xsl:for-each select="/root-element/load-qty">
        <xsl:element name="qty">
            <xsl:value-of select="."/>
        </xsl:element>
    </xsl:for-each>
</xsl:variable>

<xsl:template match="/">
    <xsl:value-of select="sum(xalan:nodeset($qty)/qty)"/>
</xsl:template>

</xsl:stylesheet>

The XML:

<root-element>
    <load-qty>12</load-qty>
    <load-qty>2</load-qty>
    <load-qty>53</load-qty>
</root-element>

Regards,

Joerg

----- Original Message -----
From: "Khalid" <k_ali@xxxxxxxxxxxxxxx>
To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, January 22, 2002 9:34 PM
Subject:  How to create a temporary xml tree nd then re use it


> Hello,
> Can I create a temporary xml tree in memory and then re-use it.
> Like
> <load-qty>12</load-qty>
> <load-qty>2</load-qty>
> <load-qty>53</load-qty>
> Say I read the document and create a new element in memory called
<qty>12</qty>
> for each element from xml file
>
> and then run sum(qty)? on this newly created tree
>
> Thanks in advance


 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.