Re: [xsl] Re: Unwanted namespace prefix _0

Subject: Re: [xsl] Re: Unwanted namespace prefix _0
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 23 Dec 2013 19:00:04 +0100
Martin Holmes wrote:
Another oddity is this: even if I define a namespace prefix for the
Examples namespace:

xmlns:eg="http://www.tei-c.org/ns/Examples";

in the stylesheet root element, Saxon still uses the _0 prefix in the
output.

It's easy to cleanup with a regex search-and-replace, but it's really
annoying. There must be some way around it, otherwise people would be
asking this question all the time, surely? I assumed I'd just forgotten
something obvious or screwed something up.

Can you post minimal but complete samples allowing us to reproduce the problem?
When I try the input file


<TEI xmlns="http://www.tei-c.org/ns/1.0"; version="5.0">
[...]
<div>
<egXML xmlns="http://www.tei-c.org/ns/Examples"; valid="true">
  For more information, consult the
  <ref target="mol:linking#linking_graphics"> guide to
  linking graphic content</ref>.</egXML>
</div>
[...]
</TEI>

with the stylesheet

<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

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

</xsl:stylesheet>

running Saxon-HE 9.5.1.3J from the command line I get the output

<?xml version="1.0" encoding="UTF-8"?><TEI xmlns="http://www.tei-c.org/ns/1.0"; version="5.0">
[...]
<div>
<egXML xmlns="http://www.tei-c.org/ns/Examples"; valid="true">
For more information, consult the
<ref target="mol:linking#linking_graphics"> guide to
linking graphic content</ref>.</egXML>
</div>
[...]
</TEI>


So how do you run Saxon? Are you sure it is Saxon serializing the result when you get those strange prefixes?

Current Thread