This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Michael Kay
Sent: Thursday, August 08, 2002 9:46 AM
To: xsl-list@lists.mulberrytech.com
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@ntlworld.com
work: Michael.Kay@softwareag.com



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]