T
tentstitcher
Hello:
I am stumped on what I belive to be a namespace issue. The XSL, source
XML, and result XML are included below. The problem is that the
template to match "getBalances" is never invoked by the
apply-templates. If I remove the default namespace in the source XML's
getBalance element, the problem goes away and the template is matched.
I spent several hours searching the newsgroups but in vain. Any help
would be appreciated.
Thanks
==xsl==
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:impl="http://city.com/ziggy/">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="SOAP-ENV:Envelope">
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:impl="http://city.com/ziggy/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsl:apply-templates select="SOAP-ENV:Header"/>
<xsl:apply-templates select="SOAP-ENV:Body"/>
</SOAP-ENV:Envelope>
</xsl:template>
<xsl:template match="SOAP-ENV:Header">
<!-- copy children without any modifications -->
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="SOAP-ENV:Body">
<SOAP-ENV:Body>
<xsl:apply-templates select="getBalances"/>
</SOAP-ENV:Body>
</xsl:template>
<xsl:template match="getBalances">
<xsl:text> HERE ! </xsl:text>
</xsl:template>
</xsl:stylesheet>
==source xml==
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<getBalances xmlns="http://city.com/ziggy/">123456</getBalances>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
==result xml==
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:impl="http://city.com/ziggy/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header/>
<SOAP-ENV:Body/>
</SOAP-ENV:Envelope>
I am stumped on what I belive to be a namespace issue. The XSL, source
XML, and result XML are included below. The problem is that the
template to match "getBalances" is never invoked by the
apply-templates. If I remove the default namespace in the source XML's
getBalance element, the problem goes away and the template is matched.
I spent several hours searching the newsgroups but in vain. Any help
would be appreciated.
Thanks
==xsl==
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:impl="http://city.com/ziggy/">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="SOAP-ENV:Envelope">
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:impl="http://city.com/ziggy/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsl:apply-templates select="SOAP-ENV:Header"/>
<xsl:apply-templates select="SOAP-ENV:Body"/>
</SOAP-ENV:Envelope>
</xsl:template>
<xsl:template match="SOAP-ENV:Header">
<!-- copy children without any modifications -->
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="SOAP-ENV:Body">
<SOAP-ENV:Body>
<xsl:apply-templates select="getBalances"/>
</SOAP-ENV:Body>
</xsl:template>
<xsl:template match="getBalances">
<xsl:text> HERE ! </xsl:text>
</xsl:template>
</xsl:stylesheet>
==source xml==
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<getBalances xmlns="http://city.com/ziggy/">123456</getBalances>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
==result xml==
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:impl="http://city.com/ziggy/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header/>
<SOAP-ENV:Body/>
</SOAP-ENV:Envelope>