2
votes

Source xml file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Inbound Message -->
<Sales xmlns="abc:org.xcbl:schemas/xcbl/v4/xcbl4.xsd" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding">
</Sales> 

Code:

 <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

    <xsl:template match="/Sales">
    </xsl:template>  

Query: In the source xml, Sales root node tag contains the below values. xmlns="abc:org.xcbl:schemas/xcbl/v4/xcbl4.xsd" xmlns:SOAPENV="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding

How to start the template?

<xsl:template match="/Sales'> 
<xsl:template match="/'> 

Above code is not working. Please help me to resolve this issue

.

1

1 Answers

1
votes

Declare namespace in XSLT, then use qualified name, e.g.:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ns="abc:org.xcbl:schemas/xcbl/v4/xcbl4.xsd">

    <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

    <xsl:template match="/ns:Sales">
    </xsl:template>

</xsl:stylesheet>