[Home] [By Thread] [By Date] [Recent Entries]

Subject: RE: Outputing the same value-of for different nodes
From: cknell@xxxxxxxxxx
Date: Wed, 22 Feb 2006 11:36:58 -0500
I cannot infer the production rule(s) from your sample input and output. Please elaborate.
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Liron <magilam@xxxxxxxxxxxxxxxx>
Sent:     Wed, 22 Feb 2006 17:19:36 +0100
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
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member