xsl-list
[Top] [All Lists]

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

2005-08-27 00:47:08
This transformation produces the desired result:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0"  xmlns:xpdl="http://www.wfmc.org/2002/XPDL1.0";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://test.de/schemas/wfdl/";>
        <xsl:output method="xml"/>

        <xsl:template match="/*">
                <xsl:element name="definitions">
                        <xsl:copy-of select=
                         "namespace::*[name() 
                                     and 
                                       not(name() = 'bo')
                                     and 
                                       not(name() = 'h2w')
                                       ]"/>
                           <xsl:element name="FlowModel"/>
                        </xsl:element>
        </xsl:template>
</xsl:stylesheet>


Cheers,
Dimitre

On 8/26/05, siva <siva(_at_)maas(_dot_)de> wrote:
here they are ...

My xsl file:

<?xml version="1.0" encoding="ISO-8859-1"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0"  xmlns:xpdl="http://www.wfmc.org/2002/XPDL1.0";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://test.de/schemas/wfdl/";>
 <xsl:output method="xml"/>
<xsl:template match="*">
   <xsl:element name="definitions">
       <xsl:copy-of select="namespace::*"/>
       <xsl:element name="FlowModel"/>
   </xsl:element>
</xsl:template>
</xsl:stylesheet>

Input.xml :

<?xml version="1.0" encoding="UTF-8"?>
<Package Id="typeoperation" Name="typeoperation"
xmlns="http://www.wfmc.org/2002/XPDL1.0"; 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";
xsi:schemaLocation="http://www.wfmc.org/2002/XPDL1.0
http://wfmc.org/standards/docs/TC-1025_schema_10_xpdl.xsd";>
   <PackageHeader>
       <XPDLVersion>1.0</XPDLVersion>
       <Vendor>Together</Vendor>
       <Created>2005-08-23 17:23:04</Created>
   </PackageHeader>
</Package>

And Output.xml without xmlns:bo="http://test.de/bo/";
xmlns:h2w="http://test.de/h2w/bo/":

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://test.de/schemas/wfdl/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:xpdl="http://www.wfmc.org/2002/XPDL1.0";>
   <FlowModel/>
</definitions>


Regards, Siva

David Carlisle wrote:

and this command copied all the attributes except the attributes starts
with "xmlns:".  This is okay.



yes, namespace declarations are not attributes to XSLT.



But nothing is copied if i use this.

<xsl:copy-of select="namespace::*"/>




Then either there is a bug in your system (which are you using) or there
is a bug in your stylesheet (post a 3 line input file and complete, small,
stylesheet that shows the problem. Without seeing more, we can't say.

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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--








--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--