Reputation: 27
Below is my xml; i am generating this xml through xsd by using datastage ETL tool, now my requirement is in the below xml i don't have data for note tag even though i am getting note tag in the xml which i don't want to display in my xml; could you please suggest me how to remove that tag
<term
rid="6662c0f2.e1b1ec6c.a1fk8pal9.8hqrjus.6af65b.8lr7d8vtg6ibohsre1bni"
name="Test Term" longDescription=" " status="CANDIDATE"
example=" " type="NONE" isModifier="false" workflowStatus="Published">
<parentCategory identity="Test Category_Edit" rid="6662c0f2.ee6a64fe.a1fk62v4g.c0kd2bc.0rjqdm.feik8m3int29gfigeshsp"/>
<replacedByTerm identity="Test Category_Edit::TestTerm 6" rid="6662c0f2.e1b1ec6c.a1fka7kac.1khu23o.2u72oe.bhpdj3dkdshb026mkdqks"/>
<referencedByCategories>
<categoryRef identity="Test RuleBook Category"
rid="6662c0f2.ee6a64fe.a1fkahnel.nso45vp.cns86c.758gjtic3rakunadr1v1k"
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<categoryRef identity="Test ACE Category"
rid="6662c0f2.ee6a64fe.a1fkahnel.nso4pkh.3pmfh7.ccc8kcdsml2s8hdhtld7k"
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</referencedByCategories>
<assignedAssets>
<BIReportMemberRef
reportModel="GAS Reporting - Detail"
reportModelNameSpace="sat1msmap054.nao.global.gmacfs.com\Public Folders\Auto Finance Packages\GAS Reporting - Detail\GAS Reporting - Detail\"
reportCollection="DIM_CONTRACT_ORA"
reportCollectionNameSpace="GAS Reporting - Detail/GAS - Database View"
reportMember="TERM"
nameSpace="[GAS - Database View].[DIM_CONTRACT_ORA]"
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</assignedAssets>
<customAttributes>
<customAttributeValue
customAttribute="ERM - General Process Category"
value="Advertising and Marketing"
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<customAttributeValue customAttribute="Changecode"
value="Y" xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<customAttributeValue
customAttribute="Test Attribute 1" value="2"
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<customAttributeValue
customAttribute="03. Is Reference Data?"
value="Yes" xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<customAttributeValue
customAttribute="06. Data Quality Performed?"
value="No" xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</customAttributes>
<relatedTerms>
<termRef identity="Test Category_Edit::Test Term5"
rid="6662c0f2.e1b1ec6c.a1fka7kac.1khv5h5.dmdrre.h0dusknvjnvdde1osbv1s"
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<termRef identity="Test Category_Edit::TestTerm 7"
rid="6662c0f2.e1b1ec6c.a1fka7kac.1khuk2l.erslsg.shh1dj9auomm9p97vr5us"
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</relatedTerms>
<note/>
<labels>
<label name="DFS Rulebook" xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<label name="FR Y-9C H1-B Retail" xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<label name="DFS - Servicing" xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</labels>
<steward userName="M7HA75" type="USER"/>
</term>
Upvotes: 1
Views: 1964
Reputation: 8272
As @potame said the way is XSL-T .. you could use following XSL
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(@*|*|comment()|processing-instruction()) and normalize-space()='']"/>
</xsl:stylesheet>
Above XSL removes all empty tag.
Upvotes: 1