Hi Friends,
In the below file, I want to delete/remove the CPT element if the attribute
UMProductId has the value "Radiation Therapy".
Code:
<?xml version="1.0" encoding="us-ascii"?>
<AuthBatch SchemaVersion="1.0" InsurerId="123" Sequence="110" CreateDate="2014-07-10T02:45:02.317" AuthorizationCount="3">
<Authorizations>
<Authorization EffectiveDate="2014-07-09" Id="12345">
<CPTs>
<CPT Sequence="1" UMProductId="Radiation Therapy" ChangeStatus="ADD" ResendIndicator="INITIAL" />
<CPT Sequence="2" UMProductId="Radiation Therapy" ChangeStatus="ADD" ResendIndicator="INITIAL" />
<CPT Sequence="3" UMProductId="Radiation Therapy" ChangeStatus="ADD" ResendIndicator="INITIAL" />
</CPTs>
<Program Id="46756" Name="test" ChangeStatus="ADD" />
</Authorization>
<Authorization EffectiveDate="2014-07-09" Id="12345">
<CPTs>
<CPT Sequence="1" UMProductId="test" ChangeStatus="ADD" ResendIndicator="INITIAL" />
<CPT Sequence="2" UMProductId="Radiation Therapy" ChangeStatus="ADD" ResendIndicator="INITIAL" />
<CPT Sequence="3" UMProductId="Radiation Therapy" ChangeStatus="ADD" ResendIndicator="INITIAL" />
</CPTs>
<Program Id="46756" Name="test" ChangeStatus="ADD" />
</Authorization>
</Authorizations>
</AuthBatch>
But, in one
Authorization, if all the CPT/UMProductId values are "Radiation Therapy" then, i would like to delete the entire
Authorization itself.
Below is my XSLT, which is removing CPT elements but not the Authorization:
Code:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="AuthBatch/Authorizations/Authorization/CPTs/CPT[@UMProductId='RADIATION THERAPY' or
@UMProductId='Radiation Therapy']"/>
<xsl:template match="AuthBatch/Authorizations/Authorization[not(CPTs/CPT)]"/>
</xsl:stylesheet>
Myoutput:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="us-ascii"?>
<AuthBatch SchemaVersion="1.0" InsurerId="123" Sequence="110" CreateDate="2014-07-10T02:45:02.317" AuthorizationCount="3">
<Authorizations>
<Authorization EffectiveDate="2014-07-09" Id="12345">
<CPTs/>
<Program Id="46756" Name="test" ChangeStatus="ADD" />
</Authorization>
<Authorization EffectiveDate="2014-07-09" Id="4567">
<CPTs>
<CPT Sequence="1" UMProductId="test" ChangeStatus="ADD" ResendIndicator="INITIAL" />
</CPTs>
<Program Id="46756" Name="test" ChangeStatus="ADD" />
</Authorization>
</Authorizations>
</AuthBatch>
Expected Output:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="us-ascii"?>
<AuthBatch SchemaVersion="1.0" InsurerId="123" Sequence="110" CreateDate="2014-07-10T02:45:02.317" AuthorizationCount="3">
<Authorizations>
<Authorization EffectiveDate="2014-07-09" Id="4567">
<CPTs>
<CPT Sequence="1" UMProductId="test" ChangeStatus="ADD" ResendIndicator="INITIAL" />
</CPTs>
<Program Id="46756" Name="test" ChangeStatus="ADD" />
</Authorization>
</Authorizations>
</AuthBatch>
Please help me. Thanks in advance!!.
Thanks,
Ajay