Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] xsl:copy-of + xsi namespace

From: "chris strub" <strub_chris@----------->
To:
Date: 10/1/2004 6:24:00 AM
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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent