[xsl] xsltproc: differences in processing namespaces

Subject: [xsl] xsltproc: differences in processing namespaces
From: Michael Stuber <mistub@xxxxxxx>
Date: Thu, 15 Jul 2010 11:11:42 +0200
Hi all,

Applying XSLT stylesheet "example.xls" to XML document "example.xml" 
using "xsltproc 1.1.12" leads to "result 1", adding the 
namespace 'xmlns:zyssql="http://www.example.ch/xmlns/0.0/zys/dbms/sql'" to 
the node "03 xul:window". Using "xsltproc 1.1.24" leads to "result 2" 
declaring the said namespace on the node "06 <zysdbs:field>".

As I need "result 1" for further processing, how can it be achieved using 
xsltproc v1.1.24?

Thx a lot, Michael

example.xml
---------------
01 <?xml version="1.0" encoding="UTF-8"?>
02 <sp:masks xmlns:sp="http://www.example.ch/xmlns/0.0/zys/forms"; 
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:zysdbs="http://www.example.ch/xmlns/0.0/zys/dbms/dbschema"; 
xmlns:zyssql="http://www.example.ch/xmlns/0.0/zys/dbms/sql";>
03 <sp:mask id="sbs-sbsanreden-list-mask" frame="list">
04 </sp:mask>
05 <sp:mask id="sbs-sbsanreden-edit-mask" frame="page">
06 <?xml-stylesheet href="../../../script/example.css" type="text/css"?>
07 <xul:window id="sbs-sbsanreden-edit" zysdbs:lang="de">
08 <xul:vbox class="scrollable" flex="1">
09 <zysdbs:fields>
10 <zysdbs:field zyssql:notnull="true"/>
11 </zysdbs:fields>>
12 </xul:vbox>
13 </xul:window>
14 </sp:mask>
15 </sp:masks>

example.xsl
--------------
01 <?xml version="1.0" encoding="iso-8859-1"?>
02 <xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:sp="http://www.example.ch/xmlns/0.0/zys/forms";
   version="1.0"
   xmlns:exsl="http://exslt.org/common";
   extension-element-prefixes="exsl"
   >
03 <xsl:param name="path" select="'temp'" />
04
05 <xsl:output method="xml" indent="yes" />
06 <xsl:template name="ignoreWhatever" priority="0.6" match="node()|@*">
07   <xsl:apply-templates select="node()|@*" />
08 </xsl:template>
09
10 <xsl:template name="copyPI" priority="0.7" match="processing-instruction()" 
mode="copy">
11   <xsl:copy-of select="." />
12 </xsl:template>
13
14 <xsl:template name="copyWhatever" priority="0.6" match="node()|@*" 
mode="copy">
15   <xsl:copy inherit-namespaces="no">
16    <xsl:apply-templates select="node()|@*" mode="copy" />
17   </xsl:copy>
18 </xsl:template>
19 
20 <xsl:template match="//sp:mask[@frame='page']" priority="1">
21  <exsl:document
    href="{$path}/{@id}.xul.xml"
    version="1.0"
    method="xml"
    indent="no"
    encoding="iso-8859-1"
    >
22    <xsl:apply-templates mode="copy" />
23   </exsl:document>
24 </xsl:template>
25
26 <xsl:template match="/" priority="1">
27  <xsl:apply-templates />
28  <dummy-root/>
29 </xsl:template>
30 
31 </xsl:stylesheet>

result 1: xsltproc v1.1.12 (Using libxml 20616, libxslt 10112 and libexslt 
810)
------------------------------------------------------------------------------------
01 <?xml version="1.0" encoding="iso-8859-1"?>
02 <?xml-stylesheet href="../../../script/example.css" type="text/css"?>
03 <xul:window 
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 
xmlns:zysdbs="http://www.example.ch/xmlns/0.0/zys/dbms/dbschema"; 
xmlns:zyssql="http://www.example.ch/xmlns/0.0/zys/dbms/sql"; 
id="sbs-sbsanreden-edit" zysdbs:lang="de">
04 <xul:vbox class="scrollable" flex="1">
05 <zysdbs:fields>
06 <zysdbs:field zyssql:notnull="true"/>
07 </zysdbs:fields>
08 </xul:vbox>
09 </xul:window>

result 2: xsltproc v1.1.24 (Using libxml 20632, libxslt 10124 and libexslt 
813)
------------------------------------------------------------------------------------
01 <?xml version="1.0" encoding="iso-8859-1"?>
02 <?xml-stylesheet href="../../../script/example.css" type="text/css"?>
03 <xul:window 
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 
xmlns:zysdbs="http://www.example.ch/xmlns/0.0/zys/dbms/dbschema"; 
id="sbs-sbsanreden-edit" zysdbs:lang="de">
04 <xul:vbox class="scrollable" flex="1">
05 <zysdbs:fields>
06 <zysdbs:field xmlns:zyssql="http://www.example.ch/xmlns/0.0/zys/dbms/sql"; 
zyssql:notnull="true"/>
07 </zysdbs:fields>
08 </xul:vbox>
09 </xul:window>

Current Thread