Subject: Re: [xsl] Creating a temporary tree in memory? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 25 Jan 2002 18:16:07 +0000 |
Hi Khalid, > Can I create a tree, like the one below using xslt > > <root-node> > <node>1</node> > <node>2</node> > <node>3</node> > </root-node> > > and then get sum of all of the above nodes.something like sum(node) > that would return 6. If you need to dynamically create this tree, then you can build the tree with: <xsl:variable name="node-rtf"> <node>1</node> <node>2</node> <node>3</node> </xsl:variable> But you then need to use the appropriate node-set() extension function for your processor to convert the result tree fragment to a node set, in order to sum the values of the node elements. For example with MSXML this would be: sum(msxsl:node-set($node-rtf)/node) If you don't need to dynamically create the tree, then you can just include it at the top level of your stylesheet (though you'll have to put the root-node element in a namespace) and access it through the document() function: sum(document('')/xsl:stylesheet/my:root-node/node) Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Creating a temporary tree in , Khalid | Thread | [xsl] Parameter Type problem, Fort, Karen |
[xsl] remove, Schwarz, Kevin | Date | Re: [xsl] Parameter Type problem, Jeni Tennison |
Month |