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

Re: [XSL] copying namesapces with prefix "xmlns:".

Subject: Re: [XSL] copying namesapces with prefix "xmlns:".
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 26 Aug 2005 12:32:59 +0100
xmlns bo
saxon6 (XSLT 1) says:

$ saxon bo.xml bo.xsl
Error at xsl:copy-of on line 11 of file:/c:/tmp/bo.xsl:
  Cannot create two namespace nodes with the same name
Transformation failed: Run-time errors were reported

saxon8 (XSLT2) says: (my indentation)
$ saxon8 -novw bo.xml bo.xsl
<?xml version="1.0" encoding="UTF-8"?>
<_0:definitions
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xpdl="http://www.wfmc.org/2002/XPDL1.0"
  xmlns:h2w="http://test.de/h2w/bo/"
  xmlns:bo="http://test.de/bo/"
  xmlns="http://www.wfmc.org/2002/XPDL1.0"
  xmlns:_0="http://test.de/schemas/wfdl/">
<FlowModel xmlns="ht
tp://test.de/schemas/wfdl/"/>
</_0:definitions>



So perhaps xslt2 does what you want (it depends what you want).
The problem is that you have conflicting definitions of the default
namespace:

The result tree already has

xmlns="http://test.de/schemas/wfdl/"

from the stylesheet, and then you are copying

xmlns="http://www.wfmc.org/2002/XPDL1.0"

from the source.

In xslt1 this is an error in xslt2 the first one gets renamed. (Actually
I haven't checked the spec again, but that's what saxon dows)

You could copy all the ones except the default namespace with
        <xsl:copy-of select="namespace::*[name()]"/>

which in saxon6 gives:
$ saxon bo.xml bo.xsl
<?xml version="1.0" encoding="utf-8"?>
<definitions
  xmlns="http://test.de/schemas/wfdl/"
  xmlns:bo="http://test.de/bo/"
  xmlns:h2w="http://test.de/h2w/bo/"
  xmlns:xpdl="http://www.wfmc.org/2002/XPDL1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FlowModel/>
</definitions>


and in saxon8 gives
$ saxon8 -novw bo.xml bo.xsl
<?xml version="1.0" encoding="UTF-8"?>
<definitions
  xmlns="http://test.de/schemas/wfdl/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xpdl="http://www.wfmc.org/2002/XPDL1.0"
  xmlns:h2w="http://test.de/h2w/bo/"
   xmlns:bo="http://test.de/bo/">
<FlowModel/>
</definitions>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.