cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick <>
Subject XSLT Transformation and namespaces issue
Date Wed, 14 Jul 2004 04:57:27 GMT
Hi everybody,

I experienced a very strange behavior of XSLT transformations when 
trying to prepare an XUpdate query. In particular, such a transformation 
would not keep the name spaces for XUpdate tags.

The set up is the following: I have a remove eXist 1.0 db installed. It 
is perfectly accessible via client and XMLDB protocol. I am able to 
create and delete resources and collectons no problem. I also use topic 
maps (which are just XML files, some of the tags would use xlink:href 
attribute), so the goal is to add a set of tags into a resource that 
contains <topicMap> root tag. This set of tags is generated by an XSLT 

<xmldb:query oid="myTexts.xml" type="update" 
<xupdate:modifications version="1.0" 
<xupdate:append select="/topicMap" 

<xupdate:element name="topic" xmlns:xupdate="">
<xupdate:attribute name="id" xmlns:xupdate="">
<xsl:value-of select="$textID" xmlns:xlink=""/>
<topicRef xlink:href="#text" xmlns:xlink=""/>
<xsl:value-of select="$textLabel"/>
<topicRef xlink:href="#plain-text-format" 
<resourceRef xlink:href="{$textLink}" 
<topicRef xlink:href="#notes" xmlns:xlink=""/>
<xsl:value-of select="$notes" xmlns:xlink=""/>

Here is the pipeline that handles the transformation:

<map:match pattern="addText">
<map:generate type="request"/>
<map:transform src="addTextParam2SourceWrite.xsl">
<map:parameter name="userName" value="TestName"/>

<map:transform type="xslt" src="addTextParam2-XMLDB.xsl">
<map:parameter name="userName" value="TestName"/>

<map:transform type="xmldb">
<map:parameter name="base" 

<map:serialize type="xml"/>

Once the XSLT transformation takes place, all of the name space 
declarations for the tags beneath <xupdate:modifications> disappear. I 
don’t know if that’s what causes the query to fail, but I attempted to 
skip the xmldb transformer and save the xml output to a file. I manually 
inserted the name spaces into all of the tags, and run it through a 
simple pipeline:

<map:match pattern="createCollection">
<map:generate src="createCollection.xml"/>
<map:transform type="xmldb">
<map:parameter name="base" 
<map:serialize type="xml"/>

This query reported to be successfull. What seems to be the problem is 
the missing name spaces (removed by the xslt transformation).

I tried to use Saxon (same problem) and XSLTC (blank output), but it 
didn’t help. I don’t know if that matters, but I also have parameter 
name space-prefixes set to true for the XML parser:

<xml-parser class="org.apache.excalibur.xml.impl.JaxpParser" 
logger="core.xml-parser" pool-grow="4" pool-max="32" pool-min="8">
<parameter name="validate" value="false"/>
<parameter name="name space-prefixes" value="true"/>

Software uses is Cocoon 2.1.5, eXist 1.0, Tomcat 5.0.19

In case there is anybody who experienced the same problem, plsease, 
share your knowledge how to make sure that the name space info is not 
being deleted by XSLT transformation.

Thank you very much in advance.

Best regards,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message