I have this xml and I only want to get the 'responseMessage' and all its content. My xsl below doesn't work. When I remove the namespace beside the requestMessage node, I'm getting the desired output but that should not be the case because it is always expected that the requestNode must have the namespace.
XML Input
<?xml version="1.0" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body >
<requestMessage xmlns="http://xmlns.oracle.com/OUMWM/Message">
<language>ENG</language>
<deviceFlag>M2ER</deviceFlag>
<badgeNumber>222</badgeNumber>
<responseMessage>
<response>
<ertResponse>
<verificationStatus>F</verificationStatus>
<errorCode>22601</errorCode>
<errorText>Badge Number 222 not found</errorText>
</ertResponse>
</response>
</responseMessage>
</requestMessage>
</soap:Body >
</soap:Envelope>
XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" version="1.0" encoding="UTF-8" />
<!-- Pretty Print Output -->
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<!-- Remove namepsaces -->
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<!-- Construct response -->
<xsl:template match="/*">
<xsl:apply-templates select="//responseMessage"/>
</xsl:template>
</xsl:stylesheet>
Desired Output:
<responseMessage>
<response>
<ertResponse>
<verificationStatus>F</verificationStatus>
<errorCode>22601</errorCode>
<errorText>Badge Number 222 not found</errorText>
</ertResponse>
</response>
</responseMessage>