OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML transformation using XSL - Please help - Thanks



Hi
 
I just want to do the following. If anyone knows how to do it, PLEASE reply me. Thanks
 
I have an XML file which looks like the one below:
 
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="XslIn.xsl"?>
<PRODUCTS>
    <PRODUCT>
         <PRODUCTID>1111</PRODUCTID>
         <EXTRAID>2345</EXTRAID>
         <EXTRAIDQ>MK</EXTRAIDQ>
         <EXTRAID>4567</EXTRAID>
         <EXTRAIDQ>MF</EXTRAIDQ>
         <LASTMODIFIED>20000208</LASTMODIFIED>
</PRODUCT>
 
<PRODUCT>
         <PRODUCTID>2222</PRODUCTID>
         <EXTRAID>9999</EXTRAID>
         <EXTRAIDQ>AB</EXTRAIDQ>
         <EXTRAID>8888</EXTRAID>
         <EXTRAIDQ>CD</EXTRAIDQ>
         <LASTMODIFIED>20000208</LASTMODIFIED>
</PRODUCT>
 
 
And I have need to convert this to another XML file using XSL. I have a java program which does the conversion. However, the problem is I am not sure how to write the XSL file for this. The output I need is something like the one below:
 
<?xml version="1.0" standalone="no"?>
<!DOCTYPE PRODUCT SYSTEM "PRODUCT.DTD">
<PRODUCTS>
 
    <PRODUCT>
        <PRODUCTID>1111</PRODUCTID>
        <EXTRAIDLIST>
            <EXTRAID EXTRAIDQ="MK">2345</PRODUCTID>
            <EXTRAID EXTRAIDQ="MF">4567</PRODUCTID>
        </EXTRAIDLIST>
        <LASTMODIFIED>20000208</LASTMODIFIED>
    </PRODUCT>
 
    <PRODUCT>
        <PRODUCTID>2222</PRODUCTID>
        <EXTRAIDLIST>
            <EXTRAID EXTRAIDQ="AB">9999</PRODUCTID>
            <EXTRAID EXTRAIDQ="CD">8888</PRODUCTID>
        </EXTRAIDLIST>
        <LASTMODIFIED>20000208</LASTMODIFIED>
    </PRODUCT>
 
</PRODUCTS>
 
====================
 
Please tell me how to write the XSL file to do this task. I have written some of it, however, I was stucked in the process when EXTRAIDs are to be grouped inside the EXTRAIDLIST.  Please reply as soon as possible and I really appreciate your help.
 
Thanks
 
Thushara