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

tansforming an XML into another XML help needed !

Subject: tansforming an XML into another XML help needed !
From: Pierre-Yves <kyrios@xxxxxxxxxxxxxx>
Date: Wed, 20 Apr 2005 06:43:44 -0700 (PDT)
french value in xml
*** Hello,
***
*** I have XML files that look like this :

<record name="myRecord">
    <item name="PageName">
        <value>myPage</value>
    </item>
    <item name="Title_EN">
        <value>english title</value>
    </item>
    <item name="Title_FR">
        <value>french title</value>
    </item>
    <item name="Paragraph">
        <value>
            <item name="SubParagraph_EN">
                <value>sub-paragraph 1 (english)</value>
            </item>
            <item name="SubParagraph_EN">
                <value>sub-paragraph 2 (english)</value>
            </item>
        </value>
        <value>
            <item name="SubParagraph_FR">
                <value>sub-paragraph 1 (french)</value>
            </item>
        </value>
     </item>
</record>

*** And I would like to convert them in this format :

<record name="myRecord">
    <item name="common">
        <value>
            <item name="PageName">
                <value>myPage</value>
            </item>
        </value>
    </item>
    <item name="english">
        <value>
            <item name="Title">
                <value>english title</value>
            </item>
            <item name="Paragraph">
                <value>
                    <item name="SubParagraph">
                        <value>sub-paragraph 1 (english)</value>
                    </item>
                    <item name="SubParagraph">
                        <value>sub-paragraph 2 (english)</value>
                    </item>
                </value>
            </item>
        </value>
    </item>
    <item name="french">
        <value>
            <item name="Title">
                <value>french title</value>
            </item>
            <item name="Paragraph">
                <value>
                    <item name="SubParagraph">
                        <value>sub-paragraph 1 (french)</value>
                    </item>
                </value>
            </item>
        </value>
    </item>
</record>


*** The items that ends with _EN should go in "english" and
*** the _EN suffix must be removed (Title_EN -> Title)
*** The ones that ends with _FR should go in "french" and
*** the _FR suffix must be removed (Title_FR -> Title)
*** The ones that don't end with _EN or _FR should go in "common"
*** if they only have 1 <value> child.
*** if they have many value childs, it depends on the items they
*** contains (look at Paragraph & SubParagraph).
*** Ideally there migth be several sub levels
*** (i.e: Paragraph -> SubParagraph -> SubSubParagraph_EN)
***
*** I have done something that works more or less for the items
*** that contains only 1 <value> tag but I don't succeed doing
*** an XSL file that works with this "complex" structure.
***
*** I would be grateful if someone could help me !
*** Regards,
*** Pierre.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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.