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

RE: Outputing the same value-of for different nodes

Subject: RE: Outputing the same value-of for different nodes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 22 Feb 2006 18:05:43 -0000
RE:  Outputing the same value-of for different nodes
If you have to output the same tree 10 times, then it's probably a good idea
to construct it in a variable and use xsl:copy-of each time you want to
output it. If you only have to output it twice, then recalculating it might
be faster. Only way to find out is to measure it.

Some processors might create a variable automatically. Saxon doesn't,
especially in the case of expressions that create new nodes, because there
are complicated rules about the identity of the nodes that are created.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Liron [mailto:magilam@xxxxxxxxxxxxxxxx] 
> Sent: 22 February 2006 16:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Outputing the same value-of for different nodes
> 
> Hello,
> 
> I wanted to ask how to output the same value on different 
> nodes without 
> effecting performance. Here's an example:
> 
> original xml file:
> 
> <tree>
>    <son><value>something1</value></son>
>    <son><value>something2</value></son>
>    <son><value>something3</value></son>
> </tree>
> 
> Lets assume I want to output something like this:
> 
> <tree>
>    <first>
>        <son><value>something1><position>1</position></value></son>
>        <son><value>something2><position>2</position></value></son>
>        <son><value>something3><position>3</position></value></son>
>    </first>
>    <second>
>        <son><value>something1><position>1</position></value></son>
>        <son><value>something2><position>2</position></value></son>
>        <son><value>something3><position>3</position></value></son>
>    </second>
> </tree>
> 
> This is just an example so please don't question the need for 
> such an output 
> ;)
> 
> In my xslt I'd probably use a xsl:for-each select="/tree/son" 
> and then 
> output the "value" node and "position()" under the "first" 
> node but would I 
> have to write a
> "xsl:for-each" again only output it for the "second" node or 
> there's some 
> way of outputing the same value, lets say "position()", under 
> different 
> output nodes?
> 
> Thank you
> Liron 

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.