Subject: RE: [xsl] Repost: How to make namespace declarations all global (i.e. in root element) From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Thu, 8 Aug 2002 17:45:48 +0100 |
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 > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Wes Kubo > Sent: 08 August 2002 16:43 > To: Xsl-List > Subject: [xsl] Repost: How to make namespace declarations all > global (i.e. in root element) > > > Warning: repost follows. Can anyone at least let me know if > this is possible or not? > -------------------------------------------------------------- > -------------- > -------- > > Hello all. > > First posting...checked all the archives and FAQ's but > couldn't find an answer to this (though it was probably in > there somewhere). I have a stylesheet that creates an output > document that has elements in multiple namespaces. I want the > result to be of this form: > > <rootElement xmlns="http://www.example.com/bar" > xmlns:foo="http:www.example.com/foo> > <foo:fooElement1>foo1</fooElement> > <foo:fooElement2>foo2</fooElement> > </rootElement> > > but this is what I get: > > <rootElement xmlns:bar="http://www.example.com/bar" > > <foo:fooElement1 > xmlns:foo="http:www.example.com/foo>foo1</fooElement> > <foo:fooElement2 > xmlns:foo="http:www.example.com/foo>foo2</fooElement> > </rootElement> > > While I realilze that both forms are of course valid, the > program that uses the output document expects to see the foo > namespace declaration in the root element (i.e. globally > accessible throughout the document). > > Is there anyway to force the foo namespace declaration to > appear in the root element so that it is available globally? > > From what I've read my impression is no, but I welcome any > advice. Btw, I'm using MSXML 4.0, not sure whether the choice > of processor matters or not. > > Thanks. > > Wes > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
<- Previous | Index | Next -> |
---|---|---|
[xsl] Repost: How to make namespace, Wes Kubo | Thread | RE: [xsl] Repost: How to make names, Wes Kubo |
RE: [xsl] XPath question, Emmanuel Oviosa | Date | Re: [xsl] How to Replace Special Ch, Mike Brown |
Month |