Categories
- All Categories
- 15 Oracle Analytics Sharing Center
- 14 Oracle Analytics Lounge
- 212 Oracle Analytics News
- 42 Oracle Analytics Videos
- 15.7K Oracle Analytics Forums
- 6.1K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 78 Oracle Analytics Trainings
- 14 Oracle Analytics Data Visualizations Challenge
- Find Partners
- For Partners
Manipulating XSL template

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" version="2.0">
<xsl:template match="/">
<SyncDCW_COMPANIES xmlns="http://www.ibm.com/maximo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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