[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Re: Unwanted namespace prefix _0


Subject: Re: [xsl] Re: Unwanted namespace prefix _0
From: Graydon <graydon@xxxxxxxxx>
Date: Mon, 23 Dec 2013 13:03:12 -0500

On Mon, Dec 23, 2013 at 09:49:07AM -0800, Martin Holmes scripsit:
> 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.

I'm not sure I understand your specific problem, but if you're using the
identity template and XSLT 2.0, instead of

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

you may wish to try

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

That won't help you with namespaces that really have to be there, but if what
you're trying to do is, effectively, copy the document out of some defined
namespace in the source document into the default namespace in the result
document I think it'll work.

-- Graydon


Current Thread
Keywords