[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Repost: How to make namespace declarations all glo

Subject: RE: 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
make names
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:  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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.