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

xsl:copy-of + xsi namespace

Subject: xsl:copy-of + xsi namespace
From: "chris strub" <strub_chris@xxxxxxxxxxx>
Date: Fri, 01 Oct 2004 12:24:22 -0600
xsi namespace
hi all,

I have a question related to the copy-of function in xslt 2.0:

I would like to deep copy a piece of my source XML to a new XML file, without declaring all Namespaces of my source XML in my copied excerpt.

I know, I can make use of the xsl:copy-of function with the copy-namespaces attribute set to 'no'. Then, my targetnamespace is indeed copied, and other Namespace declarations of my source XML document (such as the foo NS) are omitted. However, I still would like to keep the xmlns:xsi Namespace declaration in the copied excerpt (as this would make the latter self-contained).

Does anyone knows how to do this? I provide an illustrative example below.

Many thanks in advance
chris


source XML: ----------

<foo:wrapper xmlns:foo="http://foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- start excerpt to be copied -->
<bar:excerpt xmlns:bar="http://bar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<bar:subject>blablabla</bar:subject>
<bar:subject>blablabla</bar:subject>
<dc:author xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >blablabla</dc:author>
</bar:excerpt>
<!-- end excerpt to be copied -->
</foo:wrapper>


output XML:
----------

<bla:container xmlns:bla="http://bla" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- start copied excerpt -->
<bar:excerpt xmlns:bar="http://bar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<bar:subject>blablabla</bar:subject>
<bar:subject>blablabla</bar:subject>
<dc:author xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >blablabla</dc:author>
</bar:excerpt>
<!-- end copied excerpt -->
</bla:container>


_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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.