Bug #2872
Updated by Michael Kay over 7 years ago
From the saxon-help mailing list (Jorge Williams) Found a weird regression when moving from Saxon 9.4.0-9 to Saxon 9.7.0-7. We have XSLTs that process XML Schemas. After we moved to the latest version of Saxon we found that in some cases the processor would output a result document with an xs prefix that isn’t actually bound to the XMLSchema namespace. Was able to reproduce with this simple XSLT: <pre> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:foo="http://rackspace.com/foo" exclude-result-prefixes="xsd foo" version="2.0"> <xsl:variable name="elem" as="element()"><element xmlns="http://www.w3.org/2001/XMLSchema"/></xsl:variable> <xsl:template match="/"> <xsl:result-document href="foo.xml" exclude-result-prefixes="xsd foo"> <foo:foo xmlns:xsd="http://www.w3.org/201/XMLSchema"> <xsl:apply-templates select="$elem" mode="foo"/> </foo:foo> </xsl:result-document> </xsl:template> <xsl:template match="node()" mode="foo"> <xsl:copy/> </xsl:template> </xsl:stylesheet> </pre> The result foo.xml looks like this: <pre> <?xml version="1.0" encoding="UTF-8"?><foo:foo xmlns:xsd="http://www.w3.org/201/XMLSchema" xmlns:foo="http://rackspace.com/foo"><xs:element xmlns="http://www.w3.org/2001/XMLSchema"/></foo:foo> </pre> Notice that the xs prefix is added but not defined, this didn’t happen in older versions. I know the example above is contrived, but we actually hit those operations in a complex production XSL.