[oXygen-user] XSLT output root element force namespaces and attributes sequence
Martijn Van der Graaff
Tue May 25 08:58:11 CDT 2010
Hi
I need to generate a root element in a output file that contains some attributes and namespaces.
It should like this:
<?xml version="1.0" encoding="UTF-8"?>
<enfinity xsi:schemaLocation="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt dt.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt"
major="6"
minor="1"
family="enfinity"
branch="enterprise"
build="6.3.1.2.5">
what I get is this:
<enfinity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex"
xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt"
xsi:schemaLocation="http://www.intershop.com/xml/ns/enfinity/6.1/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt dt.xsd"
major="6"
minor="1"
family="enfinity"
branch="enterprise"
build="6.3.1.2.5">
How can I force in XSLT that (xmlns:xml="http://www.w3.org/XML/1998/namespace") is always added to the root element and how can I force on where the attributes are sorted.
My xslt snippet is:
<xsl:template match="/"...
<xsl:element name="enfinity" namespace="http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex">
<xsl:attribute name="xsi:schemaLocation">http://www.intershop.com/xml/ns/enfinity/6.1/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt dt.xsd</xsl:attribute>
<xsl:namespace name="xsi">http://www.w3.org/2001/XMLSchema-instance</xsl:namespace>
<xsl:namespace name="">http://www.intershop.com/xml/ns/enfinity/6.2.2/xcs/impex</xsl:namespace>
<xsl:namespace name="xml">http://www.w3.org/XML/1998/namespace</xsl:namespace>
<xsl:namespace name="dt">http://www.intershop.com/xml/ns/enfinity/6.1/core/impex-dt</xsl:namespace>
<xsl:attribute name="major" select="$major"/>
<xsl:attribute name="minor" select="$minor"/>
<xsl:attribute name="family" select="$family"/>
<xsl:attribute name="branch" select="$branch"/>
<xsl:attribute name="build" select="$build"/>
Yours,
Martijn
More information about the oXygen-user
mailing list