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

RE: [xsl] Repost: How to make namespace declarations all global (i.e. in root element)


Subject: RE: [xsl] Repost: How to make namespace declarations all global (i.e. in root element)
From: "Wes Kubo" <wkubo@xxxxxxxxxxxxx>
Date: Thu, 8 Aug 2002 11:19:13 -0700

Michael.

Thanks for the fix. I had to change it slightly to:

  	<xsl:copy-of
select="document('fooNamespace.xml')//namespace::*[.='http:www.example.com/f
oo']"/>
	or
	<xsl:copy-of
select="document('fooNamespace.xml')//namespace::foo[.='http:www.example.com
/foo']"/>

(added  the '*' or 'foo' after the namespace axis) to actually select the
nodes.

In answer to your question:
	Basically, the receiving application is coded to expect to see all the
namespaces declared as global namespaces (i.e. in the root element). This is
a noted bug.

Btw, I own XSLT - 2nd Edition and it's a great reference.

Thanks again.

Wes

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
Sent: Thursday, August 08, 2002 9:46 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Repost: How to make namespace declarations all global
(i.e. in root element)


You can get a namespace node onto an element that doesn't actually need
it by copying the namespace node from another document.

<xsl:element name="rootElement">
  <xsl:copy-of select="//namespace::[.='http:www.example.com/foo']"/>

This is defined in an erratum to XSLT 1.0.

In XSLT 2.0 there is an <xsl:namespace> instruction to achieve this
effect.

I would be interested to know why your receiving application expects to
find a namespace declaration on an element that doesn't need it.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords