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

Using XSLT to change XML and modify node with XPath

Subject: Using XSLT to change XML and modify node with XPath
From: kheris <kheris@xxxxx>
Date: Tue, 03 Feb 2009 23:19:39 +0100
  Using XSLT to change XML and modify node with XPath
Dear all,

my question is:

i need to transform XML1 to XML2. The problem I have is that i need to
query XPath to get required data. In this example, i need to find all
values in children of var-path. So, when i search for value of SubVar
in XML 1, i need to use previous nodes in final path.
In XSLT i only managed to copy XMLs and to apply function to
<test-node>. But it is not working as i wanted.
I prefer XSLT 2.0

Thanks for help!

XML 1:
<?xml version="1.0" encoding="UTF-8"?>
<xml>
 <def>
     <name>Var1</name>
     <val>0</val>
         <def>
         <name>SubVar</name>
         <val>012</val>
     </def>
 </def>
 <def>
     <name>Var2</name>
     <val>1</val>
 </def>
 <test-node>
         <use>
             <var-path>
                 <path>Var1</path>
                 <path>SubVar</path>
             </var-path>
         </use>
 </test-node>
</xml>

XML 2:
<?xml version="1.0" encoding="UTF-8"?>
<xml>
 <def>
     <name>Var1</name>
     <val>0</val>
         <def>
         <name>SubVar</name>
         <val>012</val>
     </def>
 </def>
 <def>
     <name>Var2</name>
     <val>1</val>
 </def>
 <test-node>
         <use>
             <var-path>
                 <path value="0">Var1</path>
                 <path value="012">SubVar</path>
             </var-path>
         </use>
 </test-node>
</xml>

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.