Categories
- All Categories
- Oracle Analytics and AI Learning Hub
- 53 Oracle Analytics and AI Sharing Center
- 20 Oracle Analytics and AI Lounge
- 291 Oracle Analytics and AI News
- 57 Oracle Analytics and AI Videos
- 16.3K Oracle Analytics and AI Forums
- 6.5K Oracle Analytics and AI Labs
- Oracle Analytics and AI User Groups
- 116 Oracle Analytics and AI Trainings
- 21 Oracle Analytics and AI 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