Subject: Re: [XSL] copying namesapces with prefix "xmlns:".
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Sat, 27 Aug 2005 09:39:17 +0530
|
Hi Siva,
<xsl:copy-of select="namespace::*" /> does'nt work in XSLT 1.0.
Either you have to switch to XSLT 2.0, or please don't have this
feature in your project.
Regards,
Mukul
On 8/27/05, siva <siva@xxxxxxx> wrote:
> 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
|