[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
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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|