Template Matching an Element Containing a Namespace Spec
Patrick Timmins <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Message-ID | <[email protected]> |
I have some XML to transform that looks like this:
<?xml version="1.0"?>
<?xml-stylesheet href="test.xsl" type="text/xsl"?>
<SOAP-Env:Envelope
xmlns:SOAP-Env='http://schemas.xmlsoap.org/soap/envelope'>
<SOAP-Env:Body>
<OUTER1 xmlns="urn:goobity-hoobity">
<INNER>
My Inner 1
</INNER>
<INNER>
My Inner 2
</INNER>
</OUTER1>
</SOAP-Env:Body>
</SOAP-Env:Envelope>
If I remove the 'xmlns="urn:goobity-hoobity"' specification in the
OUTER1 element, I can successfully transform the XML using the following
stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="//OUTER1" />
</body>
</html>
</xsl:template>
<xsl:template match="OUTER1">
<h3>My Transformation</h3>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="//INNER">
<font color="blue"><xsl:value-of select="." /></font>
<br/>
</xsl:template>
</xsl:stylesheet>
But if I try to transform the XML with the 'xmlns="urn:goobity-hoobity"'
specification in OUTER1 still in place, I get no output. How do I
successfully transform the XML while the xmlns="urn:goobity-hoobity"
spec is in place on the OUTER1 element?
Thanks for any help/info
Pat
--
Patrick Timmins