[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: Re: [xsl] [XSL] copying namesapces with prefix "xmlns:".
From: siva <siva@xxxxxxx>
Date: Sat, 27 Aug 2005 09:30:52 +0530

Hi,
Thankx for your analysis.
And its working with saxon 6. Thats fine.
But i am using xalan 2.6. Any idea using xalan.??

Thankx
regards, Siva

David Carlisle wrote:

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