You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Roberto Marra <rm...@montefiore.ch> on 2005/06/21 15:39:02 UTC

XPath function

Hi guys,
I don't know why with Cocoon some xpath function in an XSLT file works some other not. Let say for instance that " string-length(string)" works but if I try to use " string-join((string,string,...),sep)" Cocoon return me:

!--------------------------------------------------------------------------------
An Error Occurred
Impossibile trovare la funzione: string-join

org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:/D:/Programmi/Apache Group/cocoon-2.1.5.1/build/webapp/mf/xsl/menu/menu.xsl: org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception in creating Transform Handler

column: 51

line: 62

cause: javax.xml.transform.TransformerException: Impossibile trovare la funzione: string-join

location: null

!---------------------------------------------------------------------------------

Any idea?

Thanx in advance

Roberto

Re: XPath function

Posted by Roberto Marra <rm...@montefiore.ch>.
Hey Geert,
I want to say thank you very much! Everything works :-)

Best Regards
Roberto

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


Re: XPath function

Posted by Geert Josten <Ge...@daidalos.nl>.
In short:

- download the latest saxon.jar (saxon 8+), free available for non-commercial use i believe..
- add the following to the cocoon.xconf:
   <!--+
       | Saxon XSLT Processor
       | For old (6.5.2) Saxon use:
       |  <parameter name="transformer-factory" value="com.icl.saxon.TransformerFactoryImpl"/>
       | For new (7.x?) Saxon use:
       |  <parameter name="transformer-factory" value="net.sf.saxon.TransformerFactoryImpl"/>
       +-->
   <!-- configured for saxon 8 -->
   <component logger="core.xslt-processor"
              role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
              class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl">
      <parameter name="use-store" value="true"/>
      <parameter name="incremental-processing" value="false"/>
      <parameter name="transformer-factory" value="net.sf.saxon.TransformerFactoryImpl"/>
   </component>

(a similar section is already there)

- add the following to the top-level sitemap (if you want to have it available everywhere):

     <map:transformer logger="sitemap.transformer.saxon" name="saxon" 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>
       <use-browser-capabilities-db>false</use-browser-capabilities-db>
       <xslt-processor-role>saxon</xslt-processor-role>
       <check-includes>true</check-includes>
     </map:transformer>

- and use <transform type="saxon" ... /> instead of <transform type="xslt" ... />

Fun thing is that you can use Xalan and Saxon beside each other and choose for each conversion which 
parser to use...

I recommend to stick to Xalan (type xslt) for XSLT 1 type stylesheets. Makes it easier to recognize 
where you are using Saxon exactly.

HTH,
Geert

Roberto Marra wrote:

> Hi Geert & thanx,
> pls, can you give me some tips&tricks how to do that?
> 
> Cheers
> Roberto
> 
> ----- Original Message ----- 
> From: "Geert Josten" <Ge...@daidalos.nl>
> To: <us...@cocoon.apache.org>
> Sent: Tuesday, June 21, 2005 3:50 PM
> Subject: Re: XPath function
> 
> 
> 
>>Hi,
>>
>>That function doesn't exist in XPath 1.0:
>>
>>http://www.w3.org/TR/xpath#section-String-Functions
>>
>>But is a XPath 2.0 function:
>>http://www.w3.org/TR/xquery-operators/
>>
>>If you want to use XPath 2.0 functions, you need to configure a XSLT 2
> 
> compliant parser. For
> 
>>instance the latest Saxon parser.
>>
>>Cheers,
>>Geert
>>
>>Roberto Marra wrote:
>>
>>
>>>Hi guys,
>>>I don't know why with Cocoon some xpath function in an XSLT file works
>>>some other not. Let say for instance that " string-length(/string/)"
>>>works but if I try to use " string-join(/(string,string,...),sep/)"
>>>Cocoon return me:
>>
>>---------------------------------------------------------------------
>>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
> 
> 

-- 
=====================================
NB: het Daidalos kantoor is sinds 22 april
jl. gevestigd op een nieuw adres:

Daidalos BV
Hoekeindsehof 1 - 4
2665 JZ Bleiswijk
tel: +31 (0)10 850 12 00
fax: +31 (0)10 850 11 99

Bovenstaand adres is tevens het postadres.
======================
Geert.Josten@Daidalos.nl
IT-consultant at Daidalos BV

http://www.daidalos.nl/

GPG: 1024D/12DEBB50

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


Re: XPath function

Posted by Roberto Marra <rm...@montefiore.ch>.
Hi Geert & thanx,
pls, can you give me some tips&tricks how to do that?

Cheers
Roberto

----- Original Message ----- 
From: "Geert Josten" <Ge...@daidalos.nl>
To: <us...@cocoon.apache.org>
Sent: Tuesday, June 21, 2005 3:50 PM
Subject: Re: XPath function


> Hi,
>
> That function doesn't exist in XPath 1.0:
>
> http://www.w3.org/TR/xpath#section-String-Functions
>
> But is a XPath 2.0 function:
> http://www.w3.org/TR/xquery-operators/
>
> If you want to use XPath 2.0 functions, you need to configure a XSLT 2
compliant parser. For
> instance the latest Saxon parser.
>
> Cheers,
> Geert
>
> Roberto Marra wrote:
>
> > Hi guys,
> > I don't know why with Cocoon some xpath function in an XSLT file works
> > some other not. Let say for instance that " string-length(/string/)"
> > works but if I try to use " string-join(/(string,string,...),sep/)"
> > Cocoon return me:
>
> ---------------------------------------------------------------------
> 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: XPath function

Posted by Geert Josten <Ge...@daidalos.nl>.
Hi,

That function doesn't exist in XPath 1.0:

	http://www.w3.org/TR/xpath#section-String-Functions

But is a XPath 2.0 function:
	http://www.w3.org/TR/xquery-operators/

If you want to use XPath 2.0 functions, you need to configure a XSLT 2 compliant parser. For 
instance the latest Saxon parser.

Cheers,
Geert

Roberto Marra wrote:

> Hi guys,
> I don't know why with Cocoon some xpath function in an XSLT file works 
> some other not. Let say for instance that " string-length(/string/)" 
> works but if I try to use " string-join(/(string,string,...),sep/)" 
> Cocoon return me:

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