[xsl] Re: Unwanted namespace prefix _0

Subject: [xsl] Re: Unwanted namespace prefix _0
From: Martin Holmes <mholmes@xxxxxxx>
Date: Mon, 23 Dec 2013 11:01:55 -0800
Here are some test files:

<http://web.uvic.ca/~lancenrd/test/test.xml>
<http://web.uvic.ca/~lancenrd/test/test.xsl>

I was doing the transforms in Oxygen, using both a Transformation
Scenario and using the XSLT debugger. But when I run this on the command line, I don't have the problem.


So this must be something to do with Oxygen's settings, but I can't see
anything that seems relevant yet. If I figure it out I'll report back.
Meanwhile, anyone who happens to have Oxygen running, could you try this and let us know whether you also see the prefixes in the output?


Graydon's suggestion of copy-namespaces="no" fixes it, though.

Cheers,
Martin

On 13-12-23 10:00 AM, Martin Honnen wrote:
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