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

Re: Adding namespaces to output

Subject: Re: Adding namespaces to output
From: Kevin Jones <kjones@xxxxxxxxxxx>
Date: Mon, 23 Dec 2002 16:38:12 +0000
Re:  Adding namespaces to output
Hi Felix,

On Monday 23 Dec 2002 3:09 pm, hauser felix wrote:

> Question: Do you know how to add a prefixed namespace
> ('xmlns:p="URI"', where URI is not known in advance)
> to an output element ('<a>...</a>') WITHOUT producing
> an additional dummy-Attribute
> ('p:dummy-for-xmlns=""')? One Solution would be to
> transform the output document again and just remove
> the dummy-Attribute, but this doesn't seem to be very
> ellegant.

You can get the same effect by using a temporary tree and then copying the 
namespace out of it.

<xsl:variable name="dummy">
	<xsl:element name="p:a" namespace="something"/>
</xsl:variable>

<a>
	<xsl:copy-of select="$dummy/*/namespace::*[1]"/>
</a>

You will need to use your processors nodeset function to access $dummy in the 
copy-of. There may be a minor portability issue here in that a processor is 
not required to respect your choice of prefix, i.e. the 'p' may be changed to 
something else, although that is unlikely unless you have used 'p' for 
something else. It works ok with Saxon.

Kev.



 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.