You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Flynn <pf...@ucc.ie> on 2010/12/16 16:58:02 UTC

Switching to Saxon

I just tried this, but there seems to be a lack of up-to-date details on
doing this in Cocoon 2.1.11 with saxon9. Following the assorted web
pages for earlier versions, I got as far as adding saxon9.jar to
Cocoon's WEB-INF/lib and editing the two files (commenting out the Xalan
entries):

----- cocoon.xconf:

  <component logger="core.xslt"
             role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
             class="org.apache.cocoon.components.xslt.TraxProcessor">
     <parameter name="use-store" value="true"/>
     <parameter name="transformer-factory"
      value="net.sf.saxon.TransformerFactoryImpl"/>
  </component>

----- sitemap.xmap:

  <map:transformer name="xslt" pool-grow="2" pool-max="32"
      pool-min="8" logger="sitemap.transformer.xslt"
      src="org.apache.cocoon.transformation.TraxTransformer">
    <use-request-parameters>false</use-request-parameters>
    <use-browser-capabilities-db>false</use-browser-capabilities-db>
    <use-session-parameters>false</use-session-parameters>
    <use-cookie-parameters>false</use-cookie-parameters>
    <xslt-processor-role>saxon</xslt-processor-role>
    <check-includes>true</check-includes>
  </map:transformer>

But then Cocoon spits out:

> Internal Server Error
> Message: Could not find component (key [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
> Description: org.apache.cocoon.ProcessingException: Lookup of transformer 'xslt' failed at <map:transform> - file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
> Sender: org.apache.cocoon.servlet.CocoonServlet
> Source: Cocoon Servlet
> 
> cause
> org.apache.avalon.framework.component.ComponentException: Could not find component (key [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
> full exception chain stacktrace
> org.apache.cocoon.ProcessingException: Lookup of transformer 'xslt' failed
> 	at <map:transform> - file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
> 	at org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.java:113)

What is it actually looking for when it says
org.apache.excalibur.xml.xslt.XSLTProcessor/saxon? I have no idea what
or where "org.apache.excalibur.xml.xslt.XSLTProcessor" points to (I'm
sure it's possible to find out, but I'm not a Java programmer :-)

///Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Switching to Saxon

Posted by "Schmitz, Jeffrey A" <Je...@boeing.com>.
Sorry, I meant Tomcat.  As we only have one Cocoon based webapp, the concepts of tomcat and cocoon have kind of merged in my mind.

> -----Original Message-----
> From: Peter Flynn [mailto:pflynn@ucc.ie]
> Sent: Friday, December 17, 2010 9:08 AM
> To: users@cocoon.apache.org
> Subject: Re: Switching to Saxon
> 
> On 16/12/10 16:23, Schmitz, Jeffrey A wrote:
> > Taking a quick look, that looks like the same as I did, although I'm
> > using a saxon9he.jar file. To ask maybe a dumb question, did you
> > restart Cocoon after adding the jar?
> 
> No, I assumed any change would force Tomcat to reread it all.
> I can restart Tomcat but I'm not aware of how to restart Cocoon itself.
> 
> ///Peter
> 
> >
> >> -----Original Message-----
> >> From: Peter Flynn [mailto:pflynn@ucc.ie]
> >> Sent: Thursday, December 16, 2010 9:58 AM
> >> To: users@cocoon.apache.org
> >> Subject: Switching to Saxon
> >>
> >> I just tried this, but there seems to be a lack of up-to-date
> details
> >> on
> >> doing this in Cocoon 2.1.11 with saxon9. Following the assorted web
> >> pages for earlier versions, I got as far as adding saxon9.jar to
> >> Cocoon's WEB-INF/lib and editing the two files (commenting out the
> >> Xalan
> >> entries):
> >>
> >> ----- cocoon.xconf:
> >>
> >>   <component logger="core.xslt"
> >>
> role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
> >>
> class="org.apache.cocoon.components.xslt.TraxProcessor">
> >>      <parameter name="use-store" value="true"/>
> >>      <parameter name="transformer-factory"
> >>       value="net.sf.saxon.TransformerFactoryImpl"/>
> >>   </component>
> >>
> >> ----- sitemap.xmap:
> >>
> >>   <map:transformer name="xslt" pool-grow="2" pool-max="32"
> >>       pool-min="8" logger="sitemap.transformer.xslt"
> >>       src="org.apache.cocoon.transformation.TraxTransformer">
> >>     <use-request-parameters>false</use-request-parameters>
> >>     <use-browser-capabilities-db>false</use-browser-capabilities-db>
> >>     <use-session-parameters>false</use-session-parameters>
> >>     <use-cookie-parameters>false</use-cookie-parameters>
> >>     <xslt-processor-role>saxon</xslt-processor-role>
> >>     <check-includes>true</check-includes>
> >>   </map:transformer>
> >>
> >> But then Cocoon spits out:
> >>
> >>> Internal Server Error
> >>> Message: Could not find component (key
> >> [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
> >>> Description: org.apache.cocoon.ProcessingException: Lookup of
> >> transformer 'xslt' failed at <map:transform> -
> >> file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
> >>> Sender: org.apache.cocoon.servlet.CocoonServlet
> >>> Source: Cocoon Servlet
> >>>
> >>> cause
> >>> org.apache.avalon.framework.component.ComponentException: Could not
> >> find component (key
> >> [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
> >>> full exception chain stacktrace
> >>> org.apache.cocoon.ProcessingException: Lookup of transformer 'xslt'
> >> failed
> >>> 	at <map:transform> -
> >> file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
> >>> 	at
> >>
> org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.
> >> java:113)
> >>
> >> What is it actually looking for when it says
> >> org.apache.excalibur.xml.xslt.XSLTProcessor/saxon? I have no idea
> what
> >> or where "org.apache.excalibur.xml.xslt.XSLTProcessor" points to
> (I'm
> >> sure it's possible to find out, but I'm not a Java programmer :-)
> >>
> >> ///Peter
> >>
> >> --------------------------------------------------------------------
> -
> >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> For additional commands, e-mail: users-help@cocoon.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


Re: Switching to Saxon

Posted by Peter Flynn <pf...@ucc.ie>.
On 16/12/10 16:23, Schmitz, Jeffrey A wrote:
> Taking a quick look, that looks like the same as I did, although I'm 
> using a saxon9he.jar file. To ask maybe a dumb question, did you
> restart Cocoon after adding the jar?

No, I assumed any change would force Tomcat to reread it all.
I can restart Tomcat but I'm not aware of how to restart Cocoon itself.

///Peter

> 
>> -----Original Message-----
>> From: Peter Flynn [mailto:pflynn@ucc.ie]
>> Sent: Thursday, December 16, 2010 9:58 AM
>> To: users@cocoon.apache.org
>> Subject: Switching to Saxon
>>
>> I just tried this, but there seems to be a lack of up-to-date details
>> on
>> doing this in Cocoon 2.1.11 with saxon9. Following the assorted web
>> pages for earlier versions, I got as far as adding saxon9.jar to
>> Cocoon's WEB-INF/lib and editing the two files (commenting out the
>> Xalan
>> entries):
>>
>> ----- cocoon.xconf:
>>
>>   <component logger="core.xslt"
>>              role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
>>              class="org.apache.cocoon.components.xslt.TraxProcessor">
>>      <parameter name="use-store" value="true"/>
>>      <parameter name="transformer-factory"
>>       value="net.sf.saxon.TransformerFactoryImpl"/>
>>   </component>
>>
>> ----- sitemap.xmap:
>>
>>   <map:transformer name="xslt" pool-grow="2" pool-max="32"
>>       pool-min="8" logger="sitemap.transformer.xslt"
>>       src="org.apache.cocoon.transformation.TraxTransformer">
>>     <use-request-parameters>false</use-request-parameters>
>>     <use-browser-capabilities-db>false</use-browser-capabilities-db>
>>     <use-session-parameters>false</use-session-parameters>
>>     <use-cookie-parameters>false</use-cookie-parameters>
>>     <xslt-processor-role>saxon</xslt-processor-role>
>>     <check-includes>true</check-includes>
>>   </map:transformer>
>>
>> But then Cocoon spits out:
>>
>>> Internal Server Error
>>> Message: Could not find component (key
>> [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
>>> Description: org.apache.cocoon.ProcessingException: Lookup of
>> transformer 'xslt' failed at <map:transform> -
>> file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
>>> Sender: org.apache.cocoon.servlet.CocoonServlet
>>> Source: Cocoon Servlet
>>>
>>> cause
>>> org.apache.avalon.framework.component.ComponentException: Could not
>> find component (key
>> [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
>>> full exception chain stacktrace
>>> org.apache.cocoon.ProcessingException: Lookup of transformer 'xslt'
>> failed
>>> 	at <map:transform> -
>> file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
>>> 	at
>> org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.
>> java:113)
>>
>> What is it actually looking for when it says
>> org.apache.excalibur.xml.xslt.XSLTProcessor/saxon? I have no idea what
>> or where "org.apache.excalibur.xml.xslt.XSLTProcessor" points to (I'm
>> sure it's possible to find out, but I'm not a Java programmer :-)
>>
>> ///Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Switching to Saxon

Posted by "Schmitz, Jeffrey A" <Je...@boeing.com>.
Taking a quick look, that looks like the same as I did, although I'm using a saxon9he.jar file.  To ask maybe a dumb question, did you restart Cocoon after adding the jar?

> -----Original Message-----
> From: Peter Flynn [mailto:pflynn@ucc.ie]
> Sent: Thursday, December 16, 2010 9:58 AM
> To: users@cocoon.apache.org
> Subject: Switching to Saxon
> 
> I just tried this, but there seems to be a lack of up-to-date details
> on
> doing this in Cocoon 2.1.11 with saxon9. Following the assorted web
> pages for earlier versions, I got as far as adding saxon9.jar to
> Cocoon's WEB-INF/lib and editing the two files (commenting out the
> Xalan
> entries):
> 
> ----- cocoon.xconf:
> 
>   <component logger="core.xslt"
>              role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
>              class="org.apache.cocoon.components.xslt.TraxProcessor">
>      <parameter name="use-store" value="true"/>
>      <parameter name="transformer-factory"
>       value="net.sf.saxon.TransformerFactoryImpl"/>
>   </component>
> 
> ----- sitemap.xmap:
> 
>   <map:transformer name="xslt" pool-grow="2" pool-max="32"
>       pool-min="8" logger="sitemap.transformer.xslt"
>       src="org.apache.cocoon.transformation.TraxTransformer">
>     <use-request-parameters>false</use-request-parameters>
>     <use-browser-capabilities-db>false</use-browser-capabilities-db>
>     <use-session-parameters>false</use-session-parameters>
>     <use-cookie-parameters>false</use-cookie-parameters>
>     <xslt-processor-role>saxon</xslt-processor-role>
>     <check-includes>true</check-includes>
>   </map:transformer>
> 
> But then Cocoon spits out:
> 
> > Internal Server Error
> > Message: Could not find component (key
> [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
> > Description: org.apache.cocoon.ProcessingException: Lookup of
> transformer 'xslt' failed at <map:transform> -
> file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
> > Sender: org.apache.cocoon.servlet.CocoonServlet
> > Source: Cocoon Servlet
> >
> > cause
> > org.apache.avalon.framework.component.ComponentException: Could not
> find component (key
> [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
> > full exception chain stacktrace
> > org.apache.cocoon.ProcessingException: Lookup of transformer 'xslt'
> failed
> > 	at <map:transform> -
> file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
> > 	at
> org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.
> java:113)
> 
> What is it actually looking for when it says
> org.apache.excalibur.xml.xslt.XSLTProcessor/saxon? I have no idea what
> or where "org.apache.excalibur.xml.xslt.XSLTProcessor" points to (I'm
> sure it's possible to find out, but I'm not a Java programmer :-)
> 
> ///Peter
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


RE: Switching to Saxon

Posted by "Flynn, Peter" <pf...@ucc.ie>.
On 22/12/10 10:16, Johan Cwiklinski wrote:
[...]
> I always use the doc-available($uri) function so I can print $uri using
> xsl:message if there is an error:

Unfortunately I'm still using XSLT 1.0 in this application because the
scripts also need to run elsewhere in an environment where XSLT2 is not
available. But that will change soon :-)

>> b. Any ambiguity in template selection (normally a recoverable warning
>> if you run Saxon from the command line) returns the "Ambiguous..."
>> message as an error. Is this configurable? (ie get Saxon to not pass an
>> error status to Cocoon, but just log a warning, and continue recoverably
>> as it does in commandline mode?).
>
> I do not know.
> When I've got ambiguity in template selection, I usually solve that in
> the XSL file ;)

Yep. Fixed now...thanks for all the help.

///Peter

Re: Switching to Saxon

Posted by Johan Cwiklinski <jo...@ajlsm.com>.
Hi,

Le 22/12/2010 11:05, Peter Flynn a écrit :
> On 17/12/10 08:43, Johan Cwiklinski wrote:
>> Hello,
> [...]
>> Here is our configuration:
> [...]
>> Hope that could help you :)
> 
> Thanks very much, that did it. It was unclear from the docs where you

Cool :)

> put the name of the .jar file ("saxon9") and where you just put the name
> "saxon".
> 
> One thing that switching to Saxon has done is reveal the holes in my
> XSLT :-)
> 
> a. If a URI call to Cocoon to retrieve a web page through a Tidy
> pipeline (to make it XML) returns an empty file (really null, not even
> an empty root element), Xalan treats the statement
>    <xsl:variable name="foo" select="document($uri)"/>

I always use the doc-available($uri) function so I can print $uri using
xsl:message if there is an error:
<xsl:choose>
  <xsl:when test="doc-available($uri)">
    <xsl:variable name="foo" select="document($uri)"/>
    <!-- Some stuff -->
  </xsl:when>
  <xsl:otherwise>
    <xsl:message>Unable to load: <xsl:value-of select="$uri"/></xsl:message>
  </xsl:otherwise>
</xsl:choose>

> as a non-event, and $foo is unset (that is, a binary test for if="$foo"
> returns false). Saxon, on the other hand, emits a Java error message
> about a null pointer; technically correct, except that it makes it
> untestable because the error occurs before the document() call
> completes, so its status is inaccessible in the XSLT.
> 
> b. Any ambiguity in template selection (normally a recoverable warning
> if you run Saxon from the command line) returns the "Ambiguous..."
> message as an error. Is this configurable? (ie get Saxon to not pass an
> error status to Cocoon, but just log a warning, and continue recoverably
> as it does in commandline mode?).

I do not know.
When I've got ambiguity in template selection, I usually solve that in
the XSL file ;)

> 
> Obviously writing better XSLT is the answer...I should have paid closer
> attention to Mike and Jeni's sessions on testing at the XML Summerschool...
> 
> ///Peter

Regards,
-- 
Johan Cwiklinski
AJLSM

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Switching to Saxon

Posted by Peter Flynn <pf...@ucc.ie>.
On 17/12/10 08:43, Johan Cwiklinski wrote:
> Hello,
[...]
> Here is our configuration:
[...]
> Hope that could help you :)

Thanks very much, that did it. It was unclear from the docs where you
put the name of the .jar file ("saxon9") and where you just put the name
"saxon".

One thing that switching to Saxon has done is reveal the holes in my
XSLT :-)

a. If a URI call to Cocoon to retrieve a web page through a Tidy
pipeline (to make it XML) returns an empty file (really null, not even
an empty root element), Xalan treats the statement
   <xsl:variable name="foo" select="document($uri)"/>
as a non-event, and $foo is unset (that is, a binary test for if="$foo"
returns false). Saxon, on the other hand, emits a Java error message
about a null pointer; technically correct, except that it makes it
untestable because the error occurs before the document() call
completes, so its status is inaccessible in the XSLT.

b. Any ambiguity in template selection (normally a recoverable warning
if you run Saxon from the command line) returns the "Ambiguous..."
message as an error. Is this configurable? (ie get Saxon to not pass an
error status to Cocoon, but just log a warning, and continue recoverably
as it does in commandline mode?).

Obviously writing better XSLT is the answer...I should have paid closer
attention to Mike and Jeni's sessions on testing at the XML Summerschool...

///Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Switching to Saxon

Posted by Johan Cwiklinski <jo...@ajlsm.com>.
Hello,

Le 16/12/2010 16:58, Peter Flynn a écrit :
> I just tried this, but there seems to be a lack of up-to-date details on
> doing this in Cocoon 2.1.11 with saxon9. Following the assorted web
> pages for earlier versions, I got as far as adding saxon9.jar to
> Cocoon's WEB-INF/lib and editing the two files (commenting out the Xalan
> entries):
> 
> ----- cocoon.xconf:
> 
>   <component logger="core.xslt"
>              role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
>              class="org.apache.cocoon.components.xslt.TraxProcessor">
>      <parameter name="use-store" value="true"/>
>      <parameter name="transformer-factory"
>       value="net.sf.saxon.TransformerFactoryImpl"/>
>   </component>
> 
> ----- sitemap.xmap:
> 
>   <map:transformer name="xslt" pool-grow="2" pool-max="32"
>       pool-min="8" logger="sitemap.transformer.xslt"
>       src="org.apache.cocoon.transformation.TraxTransformer">
>     <use-request-parameters>false</use-request-parameters>
>     <use-browser-capabilities-db>false</use-browser-capabilities-db>
>     <use-session-parameters>false</use-session-parameters>
>     <use-cookie-parameters>false</use-cookie-parameters>
>     <xslt-processor-role>saxon</xslt-processor-role>
>     <check-includes>true</check-includes>
>   </map:transformer>
> 
> But then Cocoon spits out:
> 
>> Internal Server Error
>> Message: Could not find component (key [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
>> Description: org.apache.cocoon.ProcessingException: Lookup of transformer 'xslt' failed at <map:transform> - file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
>> Sender: org.apache.cocoon.servlet.CocoonServlet
>> Source: Cocoon Servlet
>>
>> cause
>> org.apache.avalon.framework.component.ComponentException: Could not find component (key [org.apache.excalibur.xml.xslt.XSLTProcessor/saxon])
>> full exception chain stacktrace
>> org.apache.cocoon.ProcessingException: Lookup of transformer 'xslt' failed
>> 	at <map:transform> - file:///usr/share/tomcat5/webapps/ROOT/sitemap.xmap:1174:71
>> 	at org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.java:113)
> 
> What is it actually looking for when it says
> org.apache.excalibur.xml.xslt.XSLTProcessor/saxon? I have no idea what
> or where "org.apache.excalibur.xml.xslt.XSLTProcessor" points to (I'm
> sure it's possible to find out, but I'm not a Java programmer :-)
> 
> ///Peter
> 

Here is our configuration:
cocoon.xconf:
<!--+
    | Saxon XSLT Processor : 8.x
    +-->
  <component
    class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl"
    logger="core.xslt-processor"
    role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon8"
    pool-grow="2"
    pool-min="8"
    pool-max="32">
      <parameter name="use-store" value="true" />
      <parameter name="incremental-processing" value="false" />
      <parameter name="transformer-factory"
value="net.sf.saxon.TransformerFactoryImpl" />
    </component>

  <!-- Xpath Processor: -->
  <xpath-processor
    class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"
    logger="core.xpath-processor" />

sitemap.xmap:
  <map:transformer
    name="xslt2"
    logger="sitemap.transformer.xslt"
    pool-grow="2"
    pool-max="32"
    pool-min="8"
    src="org.apache.cocoon.transformation.TraxTransformer">
      <use-request-parameters>false</use-request-parameters>
      <use-session-parameters>false</use-session-parameters>
      <use-cookie-parameters>false</use-cookie-parameters>
      <xslt-processor-role>saxon8</xslt-processor-role>
      <check-includes>true</check-includes>
    </map:transformer>

Hope that could help you :)

Regards,
-- 
Johan Cwiklinski
AJLSM

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org