Page 1 of 1

xml to xml transform

Posted: Tue Aug 26, 2008 5:08 am
by uirp03
Hi, i need to convert a raw xml file into another xml file using xslt. I have no idea how to achieve the desire output. Can anyone provide an example? Thanks.

Input xml:
<root>
<header>
<row>
<entry>header</entry>
<entry>name1</entry>
<entry>result1</entry>
</row>
<row>
<entry>header</entry>
<entry>name2</entry>
<entry>result2</entry>
<entry>result22</entry>
</row>
<row>
<entry>reading</entry>
<entry>name3</entry>
<entry>result3</entry>
</row>
<row>
<entry>reading</entry>
<entry>name4</entry>
<entry>result4</entry>
<entry>result5</entry>
</row>
</header>
</root>

The final xml will be like this:

<root>
<header>
<row>
<name>name1</name>
<result>result1</result>
</row>
<row>
<name>name2</name>
<result>result2</result>
<result2>result2</result2>
</row>
</header>
<reading>
<row>
<name>name3</name>
<result>result3</result>
</row>
<row>
<name>name4</name>
<result>result4</result>
<value>result5</value>
</row>
</reading>
</root>

Re: xml to xml transform

Posted: Tue Aug 26, 2008 9:53 am
by sorin_ristache
Hello,

In Oxygen you convert an XML file with an XSLT stylesheet by running a transformation scenario in which the XSLT stylesheet and other parameters are set. You create a transformation scenario with the button New of the dialog Configure Transformation Scenario opened with the action Configure Transformation Scenario available on the toolbar Transformation and also on the menu Document -> Transformation.

You can read about writing an XSLT stylesheet that converts an input XML file to other XML file for example at zvon.org and at w3schools.com.


Regards,
Sorin