I have one xml need to create xslt with custom tags need to get some example or any help on xslt would be helpful. this is the input xml what I am getting need to divide into two sections using xslt
1.xml
<XMLJRN>
<P>
<E name="Statement_Document">Statement_Document</E>
<E name="StatementIdentifier">MHS</E>
<E name="CurrencyCode">USD</E>
<E name="ClaimCount">2</E>
<E name="Claim">Claim</E>
<E name="ClaimNumber">050001741183100</E>
<E name="AmountPaid">0.00</E>
<E name="CurrencyCode">USD</E>
<E name="Claim">Claim</E>
<E name="ClaimNumber">050001741179800</E>
<E name="AmountPaid">150.00</E>
<E name="CurrencyCode">USD</E>
</P>
</XMLJRN>
I need to get the output xml as below
<Doc1Statement_STG>
<StatementDocument>Statement_Document</StatementDocument>
<StatementIdentifier>MHS</StatementIdentifier>
<ClaimCount>2</ClaimCount>
<Doc1Claim_STG>
<ClaimNumber>050001741183100</ClaimNumber>
<AmountPaid>0.00</AmountPaid>
<ClaimCurrencyCode>USD</ClaimCurrencyCode>
</Doc1Claim_STG>
<Doc1Claim_STG>
<ClaimNumber>050001741179800</ClaimNumber>
<AmountPaid>150.00</AmountPaid>
<ClaimCurrencyCode>USD</ClaimCurrencyCode>
</Doc1Claim_STG>
</Doc1Statement_STG>
Thanks
I have tried with this below code
<xsl:template match="XMLJRN/P">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="E">
<Doc1Statement_STG>
<xsl:element name="{@name}">
<xsl:value-of select="."/>
</xsl:element>
</Doc1Statement_STG>
</xsl:template>
I am unable to add tag for each claim amount, any help
No comments:
Post a Comment