Oracle Transactional Business Intelligence Idea Lab

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Manipulating XSL template

1
Views
0
Comments

Organization Name

District of Columbia Water and Sewer Authority

Description

We have developed Xsl template to extract XML output.  The problem is we need to add an attribute to the current group element i.e COMPANIES. Any help with this highly appreciated.

 

Use Case and Business Need

xsl Code:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform&quot; version="2.0">
   <xsl:template match="/">
      <SyncDCW_COMPANIES xmlns="http://www.ibm.com/maximo&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; baseLanguage="EN">
         <xsl:for-each-group select="/DATA/COMPANIES" group-by="./ADDRESS_LINE1">
            <DCW_COMPANIESSet>
               <xsl:copy-of select="current-group()" copy-namespaces="no" />
            </DCW_COMPANIESSet>
         </xsl:for-each-group>
      </SyncDCW_COMPANIES>
   </xsl:template>
</xsl:stylesheet>

Sample output:

<?xml version="1.0" encoding="UTF-8"?>
<SyncDCW_COMPANIES xmlns="http://www.ibm.com/maximo&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; baseLanguage="EN">
   <DCW_COMPANIESSET>
      <COMPANIES>
         <ADDRESS1>4141 Old William Penn Hwy</ADDRESS1>
         <ADDRESS2>Monroeville</ADDRESS2>
         <ADDRESS3>PA</ADDRESS3>
         <ADDRESS4>15146</ADDRESS4>
         <PHONE />
         <COMPANY>100001</COMPANY>
         <DISABLED>0</DISABLED>
         <CURRENCYCODE>USD</CURRENCYCODE>
         <ORGID>DC_WASA</ORGID>
         <TYPE>V</TYPE>
         <NAME>ABC Corporation</NAME>
         <COMPCONTACT>
            <CONTACT>John..Smith</CONTACT>
            <EMAIL>jsmith@abccorp1234.com</EMAIL>
            <VOICEPHONE />
         </COMPCONTACT>
      </COMPANIES>
   </DCW_COMPANIESSET>
</SyncDCW_COMPANIES>


Desired Output:

?xml version="1.0" encoding="UTF-8"?>
<SyncDCW_COMPANIES xmlns="http://www.ibm.com/maximo&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; baseLanguage="EN">
   <DCW_COMPANIESSET>
      <COMPANIES Action='AddChange'>
         <ADDRESS1>4141 Old William Penn Hwy</ADDRESS1>
         <ADDRESS2>Monroeville</ADDRESS2>
         <ADDRESS3>PA</ADDRESS3>
         <ADDRESS4>15146</ADDRESS4>
         <PHONE />
         <COMPANY>100001</COMPANY>
         <DISABLED>0</DISABLED>
         <CURRENCYCODE>USD</CURRENCYCODE>
         <ORGID>DC_WASA</ORGID>
         <TYPE>V</TYPE>
         <NAME>ABC Corporation</NAME>
         <COMPCONTACT>
            <CONTACT>John..Smith</CONTACT>
            <EMAIL>jsmith@abccorp1234.com</EMAIL>
            <VOICEPHONE />
         </COMPCONTACT>
      </COMPANIES>
   </DCW_COMPANIESSET>
</SyncDCW_COMPANIES>

 

Original Idea Number: 9e36255e01

1
1 votes

Submitted · Last Updated