cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Huttar" <>
Subject Error: The Saxon DOM cannot be updated
Date Fri, 30 Jul 2004 14:07:29 GMT
Dear Cocoonists,

I'm getting a strange error when using Saxon with Cocoon.
Versions: Tomcat 4.1, Cocoon 2.1.2, Saxon 7.9
Summary of problem: I get an error "The Saxon DOM cannot be updated"
  at a point in the pipeline where Saxon isn't supposed to be involved.

I have Saxon associated with the "xslt-saxon" transformer type,
as shown in my sitemap:

    <map:generators default="file"/>
    <map:transformers default="xslt">
      <map:transformer name="xslt-saxon" pool-grow="2" pool-max="32" pool-min="8"

xslt (Xalan) is defined as the default transformer in the Cocoon sitemap:

  <map:transformers default="xslt">
    <!-- NOTE: This is the default XSLT processor. -->
    <map:transformer logger="sitemap.transformer.xslt" name="xslt" pool-grow="2" pool-max="32"
pool-min="8" src="org.apache.cocoon.transformation.TraxTransformer">

Incidentally, this is how Saxon is set up in my cocoon.xconf:

  <component logger="core.xslt-processor"
     <parameter name="use-store" value="true"/>
     <parameter name="transformer-factory" value="net.sf.saxon.TransformerFactoryImpl"/>
     <parameter name="incremental-processing" value="false"/>

That part seems to be working fine.

The problem scenario is this.
I have a pipeline as follows:

      <map:match pattern="test-name-index/*/*/*">
        <map:generate src="sources/Language-name-index{3}.xml" label="raw" />
        <map:transform src="transforms/name-index-step1-xsl{2}.xsl"  type="xslt-saxon"
        <map:transform src="transforms/add-source-write.xsl" type="xslt" label="raw2">
          <map:parameter name="output-file" value="Language-name-index{3}-grouped.xml"
        <map:transform type="write-source" />
        <map:serialize type="xml" />

(The first * in the match pattern was originally intended to let me
parameterize the transformer type of the first transformer, e.g. to
switch between xslt and xslt-saxon. However the sitemap processor
complained that "{1}" wasn't a valid transformer type. This is a side
issue but if anyone has an answer I'd be interested.)

The idea is to take data from the XML source file, perform a grouping
transformation on it using the name-index-step1-xsl1.xsl stylesheet
using Saxon, wrap <source:write> markup around the result, and then
pass the whole through the write-source processor to send it to a file.

I use ?cocoon-view=raw, raw1, raw2 to check the progress at various points
in the pipeline.
When I run the URL "test-name-index/xslt-saxon/1/Tiny?cocoon-view=raw2",
the pipeline runs successfully up to raw2, showing me the desired XML
wrapped in <source:write> markup. However, if I take off the cocoon-view
parameter, allowing the whole pipeline to run, I get the error:
 Failed to execute pipeline.
 org.apache.cocoon.ProcessingException: Failed to execute pipeline.:  java.lang.RuntimeException:
java.lang.UnsupportedOperationException: The Saxon DOM cannot be updated

Looking in the error.log, I find:

FATAL_E (2004-07-30) 08:54.16:200   [core.xslt-processor] (/cvsmount/ethnologue/
test-name-index/xslt-saxon/1/Tiny) Thread-9/TraxErrorHandler: Error in TraxTrans
former: file:/C:/Program%20Files/Apache%20Group/Tomcat%204.1/./../cocoon/./cvsmo
unt/ethnologue/transforms/add-source-write.xsl; Line 14; Column 21;
; SystemID: file:/C:/Program%20Files/Apache%20Group/Tomcat%204.1/./../cocoon/./c
vsmount/ethnologue/transforms/add-source-write.xsl; Line#: 14; Column#: 21
javax.xml.transform.TransformerException: java.lang.UnsupportedOperationExceptio
n: The Saxon DOM cannot be updated
        at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr

So the error is reported in add-source-write.xsl -- the stylesheet that was
working fine when I used cocoon-view=raw2. Moreover, add-source-write.xsl
is done using xslt, not xslt-saxon; so why a Saxon error at all?
(In fact, if I change "xslt-saxon" to "xslt" in the above pipeline,
I still get the same error. Is it possible that Saxon is being used
even where type="xslt"? If so, how would I know it and how would I
fix it?)
Thirdly, I can't see that any attempt is being made to update a DOM.
Does it mean add-source-write.xsl is attempting to modify a DOM output
by Saxon's processing of name-index-step1-xsl1.xsl?

Here is add-source-write.xsl, with the "offending" line 14 marked:

<xsl:stylesheet version="1.0" xmlns:xsl=""
  <xsl:output method="xml" version="1" indent="yes" encoding="utf-8" />
  <xsl:param name="output-file" select="/.." />

  <xsl:template match="/">
      <source:fragment><xsl:copy-of select="*" /></source:fragment><!--line

Here is the output after add-source-write.xsl, when the above pipeline is
used with cocoon-view=raw2:

<source:write xmlns:source="">
    <Language-name-index xmlns:od="urn:schemas-microsoft-com:officedata">
      <entry name="Aqua">
          <Type>alt. dial.</Type>
          <Key2>alt. dial.Ejagham.ETU</Key2>
          <Type>alt. dial.</Type>
          <Key2>alt. dial.Ejagham.ETU</Key2>
      <entry name="Ara">
          <Key3>Pacific.New Caledonia</Key3>
          <Key3>Pacific.Papua New Guinea</Key3>

For completeness, I'll show name-index-step1-xsl1.xsl, though it doesn't
seem relevant to the error:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:strip-space elements="*"/>
	<!-- The maximum number of records for a given name. At present there are 108 records
	<xsl:variable name="maxRecords">20</xsl:variable>
	<xsl:template match="/Language-name-index">
			<xsl:for-each select="*">
				<xsl:if test="position() = 1 or KEY1 != preceding-sibling::*[1]/KEY1">
					<xsl:variable name="key" select="KEY1"/>
					<xsl:element name="entry">
						<xsl:attribute name="name"><xsl:value-of select="PRINT_NAME"/></xsl:attribute>
						<xsl:call-template name="copy-records-with-same-key">
							<xsl:with-param name="record" select="."/>
	<xsl:template name="copy-records-with-same-key">
		<xsl:param name="record"/>
		<xsl:copy-of select="$record"/>
		<xsl:if test="$record/KEY1 = $record/following-sibling::*[1]/KEY1">
			<xsl:call-template name="copy-records-with-same-key">
				<xsl:with-param name="record" select="$record/following-sibling::*[1]"/>

I read somewhere of somebody else having the problem that when they
tried using Saxon at all, it got used everywhere. Is this one of
those things where I have to rename saxon7.jar to zsaxon7.jar
so it comes after xalan in the classpath??

Thanks for any help...

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

View raw message