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

Re: Using XSLT to change XML and modify node with XPat

Subject: Re: Using XSLT to change XML and modify node with XPath
From: kheris <kheris@xxxxx>
Date: Thu, 05 Feb 2009 20:50:39 +0100
Re:  Using XSLT to change XML and modify node with XPat
Hi all,

Maybe anyone can still help me on this:
I need to transform XML1 to XML2.
The procedure i am looking for is something like:
1) i reach the node var-path
2) i meet the node path. I get the value, and i search for /def[name=value]
3) i meet the second node path in current var-path. I get the value,
and now i search for
/def[name=value_of_path_before]//def[value_of_path_now]
4) etc.

So, i use previously found node as starting node now. What is more, i
need to use //, as structure of path can be deeper then explicitly
said. But i can return only first found node (so, if more nodes
satisfy that, i get always the first one).

I have XQuery for searching/modifying nodes. Maybe is it possible to combine
it (i tried to google some more info, but most tool don't allow that)


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.