I apologize if this is received twice.

I'm having a problem getting my templates to apply when my root node has a namespace. If my XML file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<a xmlns="http://foo";>
<b>
  <c />
</b>
</a>

and my XSL file looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="b">
  <d>
  </d>
</xsl:template>

<xsl:template match="@* | node()">
<xsl:copy>
  <xsl:apply-templates select="@*"/>
  <xsl:apply-templates/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

I am getting the same result as the original file (there is no <d> node written to the result). I'm running Xalan on the command line, using:

java -classpath "xml-apis.jar;xercesImpl.jar;xalan.jar;serializer.jar" org.apache.xalan.xslt.Process -in input.xml -xsl transformation.xsl -out result.xml

If I remove the xmlns attribute from my input file, things work fine and I end up with the expected result. I don't know if this is a problem with how I'm specifying something, a problem with Xalan, or maybe even a problem with the underlying Xerces library. I know that we disable namespace processing using Xerces for a few other things, but I don't know if it's possible to do that with Xalan. Any help would be greatly appreciated.

Thanks,

Dale Beermann

Reply via email to