You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2003/12/17 15:58:13 UTC

[Woody] XSLT error

Hi All

I had a project working with Woody.
I just updated to the latest CVS and am having a strange problem:

org.apache.cocoon.ProcessingException: Unable to get transformer  
handler for  
file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
samples/woody/resources/woody-samples-styling.xsl:  
org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception in  
creating Transform Handler

cause: javax.xml.transform.TransformerException:  
file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
samples/woody/resources/woody-field-styling.xsl: line 8: Variable  
'resources-uri' is multiply defined in the same scope.  
file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
samples/woody/resources/woody-calendar-styling.xsl: line 8: Variable  
'resources-uri' is multiply defined in the same scope.  
file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
samples/woody/resources/woody-advanced-field-styling.xsl: line 8:  
Variable 'resources-uri' is multiply defined in the same scope.

The variable 'resources-uri' is indeed defined on each of these XSLTs,  
which is IMHO unnecessary.

The strange thing is ..... I do not get this error with the Woody  
Samples.

First I looked to see if changing the Samples from using Xalan to XSLTC  
raised the problem (we have to use XSLTC because of the UTF problems  
with Xalan).

This had no effect.

The next difference between our project and the Samples was that we  
have a local StyleSheet called 'woody.xsl' which includes the woody  
samples stylesheet thus:

	<xsl:include  
href="context://samples/woody/resources/woody-samples-styling.xsl"/>

Because we have some custom styled widgets.

I switched this to load the 'woody-samples-styling.xsl' directly from  
the sitemap, that made no difference either.

Any suggestions as to what might be causing this?

Thanks

regards Jeremy

Re: [Woody] XSLT error

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 3 Feb 2004, at 18:20, Joerg Heinicke wrote:

> Hello Jeremy,
>
> I guess it was me :)

Thanks for your reply ;)

>
>>> cause: javax.xml.transform.TransformerException:   
>>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/ 
>>> webapp/ samples/woody/resources/woody-field-styling.xsl: line 8:  
>>> Variable  'resources-uri' is multiply defined in the same scope.   
>>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/ 
>>> webapp/ samples/woody/resources/woody-calendar-styling.xsl: line 8:  
>>> Variable  'resources-uri' is multiply defined in the same scope.   
>>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/ 
>>> webapp/ samples/woody/resources/woody-advanced-field-styling.xsl:  
>>> line 8:  Variable 'resources-uri' is multiply defined in the same  
>>> scope.
>>>
>>> The variable 'resources-uri' is indeed defined on each of these  
>>> XSLTs,  which is IMHO unnecessary.
>
> This is not correct. This would only be correct if the files were  
> always used alltogether - but then we don't need different files and  
> we had a monolithic one. But I want to use the files separately.

OK

> My refactoring changed the relations between the stylesheets in that  
> way, that they should be used independently on each other. So for  
> example the advanced styling now extends the basic field styling -  
> both need the uri and both should be used independently. For working  
> with only few of the stylesheets the param must be declared for every  
> stylesheet that uses it.

Yup

>> My changes from 19th Dec 2003 to remove the duplicate 'resources-uri'  
>>  variable declaration in several woody XSLT files appears to have  
>> been  reverted.
>> Any idea why?
>> I cannot find a record of the revision in CocoonCVS mailings.
>
> Here it is:  
> http://marc.theaimsgroup.com/?l=xml-cocoon-cvs&m=107479455713545&w=4

Thanks for clearing that puzzle up

>
>> Does anyone object to me changing it back again to remove the   
>> duplicates?
>
> To be honest: yes. It's part of the XSLT spec that this must be  
> handled by the XSLT processor. The error message "multiply defined in  
> the same scope" is just wrong, it's not the same scope.

Hmmm

> I would like to see it resolved locally for you, not by making the  
> stylesheets dependent on each other. The problem is now that it just  
> does not work for you. But why? I have it working on my system at work  
> (using Xalan as it is the default processor IIRC).

They work fine with Xalan, but not with XSLTC.

> Know I see possible reasons:
> - Your Xalan version is newer than mine (I use 2.5.1 because of  
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24457).
> - Your Xalan version is older than mine. You were not the first having  
> an endorsed libs problem without knowing it ;-) Can you please check  
> your Xalan version in use using  
> http://xml.apache.org/xalan-j/faq.html#environmentcheck?

I have the current CVS.
It is using xalan-2.5.2.jar (I checked)

> - You never tried Xalan, but only XSLTC. I will test it tomorrow if it  
> is just a problem of XSLTC.
> I don't see any additional difference between our systems, but the  
> working of the Woody samples in comparison to your project is indeed  
> strange.

I am deeply suspecting XSLTC now.
Even after removing the duplicated variable declarations, I was unable  
to get the stylesheets to work with XSLTC this time.

It is very difficult to work out why .... XSLTC's error messages are  
not useful.

After a brute-force binary search for the template causing the trouble,  
it came down to this template at the end of 'woody-field-styling.xsl' :

   <xsl:template match="@*|node()" priority="-1">
     <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
   </xsl:template>

There is clearly nothing wrong with this :(

So woody does not seem usable with XSLTC.
Can anyone else confirm this?

regards Jeremy

Re: [Woody] XSLT error

Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Jeremy,

I guess it was me :)

>> cause: javax.xml.transform.TransformerException:  
>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
>> samples/woody/resources/woody-field-styling.xsl: line 8: Variable  
>> 'resources-uri' is multiply defined in the same scope.  
>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
>> samples/woody/resources/woody-calendar-styling.xsl: line 8: Variable  
>> 'resources-uri' is multiply defined in the same scope.  
>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
>> samples/woody/resources/woody-advanced-field-styling.xsl: line 8:  
>> Variable 'resources-uri' is multiply defined in the same scope.
>>
>> The variable 'resources-uri' is indeed defined on each of these 
>> XSLTs,  which is IMHO unnecessary.

This is not correct. This would only be correct if the files were always 
used alltogether - but then we don't need different files and we had a 
monolithic one. But I want to use the files separately. My refactoring 
changed the relations between the stylesheets in that way, that they 
should be used independently on each other. So for example the advanced 
styling now extends the basic field styling - both need the uri and both 
should be used independently. For working with only few of the 
stylesheets the param must be declared for every stylesheet that uses it.

> My changes from 19th Dec 2003 to remove the duplicate 'resources-uri'  
> variable declaration in several woody XSLT files appears to have been  
> reverted.
> 
> Any idea why?
> 
> I cannot find a record of the revision in CocoonCVS mailings.

Here it is: 
http://marc.theaimsgroup.com/?l=xml-cocoon-cvs&m=107479455713545&w=4

> Does anyone object to me changing it back again to remove the  duplicates?

To be honest: yes. It's part of the XSLT spec that this must be handled 
by the XSLT processor. The error message "multiply defined in the same 
scope" is just wrong, it's not the same scope.

I would like to see it resolved locally for you, not by making the 
stylesheets dependent on each other. The problem is now that it just 
does not work for you. But why? I have it working on my system at work 
(using Xalan as it is the default processor IIRC).

Know I see possible reasons:
- Your Xalan version is newer than mine (I use 2.5.1 because of 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24457).
- Your Xalan version is older than mine. You were not the first having 
an endorsed libs problem without knowing it ;-) Can you please check 
your Xalan version in use using 
http://xml.apache.org/xalan-j/faq.html#environmentcheck?
- You never tried Xalan, but only XSLTC. I will test it tomorrow if it 
is just a problem of XSLTC.
I don't see any additional difference between our systems, but the 
working of the Woody samples in comparison to your project is indeed 
strange.

Joerg

Re: [Woody] XSLT error

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 17 Dec 2003, at 14:58, Jeremy Quinn wrote:

>
> cause: javax.xml.transform.TransformerException:  
> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
> samples/woody/resources/woody-field-styling.xsl: line 8: Variable  
> 'resources-uri' is multiply defined in the same scope.  
> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
> samples/woody/resources/woody-calendar-styling.xsl: line 8: Variable  
> 'resources-uri' is multiply defined in the same scope.  
> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
> samples/woody/resources/woody-advanced-field-styling.xsl: line 8:  
> Variable 'resources-uri' is multiply defined in the same scope.
>
> The variable 'resources-uri' is indeed defined on each of these XSLTs,  
> which is IMHO unnecessary.
>

My changes from 19th Dec 2003 to remove the duplicate 'resources-uri'  
variable declaration in several woody XSLT files appears to have been  
reverted.

Any idea why?

I cannot find a record of the revision in CocoonCVS mailings.

Does anyone object to me changing it back again to remove the  
duplicates?


thanks

regards Jeremy

Re: [Woody] XSLT error

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 17 Dec 2003, at 16:33, Sylvain Wallez wrote:

Thanks for your reply Sylvain.

> Jeremy Quinn wrote:
>
>> Hi All
>>
>> I had a project working with Woody.
>> I just updated to the latest CVS and am having a strange problem:
>>
>> org.apache.cocoon.ProcessingException: Unable to get transformer   
>> handler for   
>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/ 
>> webapp/ samples/woody/resources/woody-samples-styling.xsl:   
>> org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception in   
>> creating Transform Handler
>>
>> cause: javax.xml.transform.TransformerException:   
>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/ 
>> webapp/ samples/woody/resources/woody-field-styling.xsl: line 8:  
>> Variable  'resources-uri' is multiply defined in the same scope.   
>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/ 
>> webapp/ samples/woody/resources/woody-calendar-styling.xsl: line 8:  
>> Variable  'resources-uri' is multiply defined in the same scope.   
>> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/ 
>> webapp/ samples/woody/resources/woody-advanced-field-styling.xsl:  
>> line 8:  Variable 'resources-uri' is multiply defined in the same  
>> scope.
>>
>> The variable 'resources-uri' is indeed defined on each of these  
>> XSLTs,  which is IMHO unnecessary.
>>
>> The strange thing is ..... I do not get this error with the Woody   
>> Samples.
>>
>> First I looked to see if changing the Samples from using Xalan to  
>> XSLTC  raised the problem (we have to use XSLTC because of the UTF  
>> problems  with Xalan).
>
>
> UTF problems in Xalan? Can you tell more about this?

Xalan croaks on some Unicode characters.

I believe it could be :

	http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24457

eg. Xalan will not process a document with Unicode character &#9650;  
(▲) whilst XSLTC has no problem.
I have had this problem with about 10 characters so far ....

>
>> This had no effect.
>
>
> You mean XSLTC runs the samples with no problem?

In my quick trials, it ran fine on the Woody Samples.
ie. I changed the default Transformer to 'xslt' in the Woody Samples  
sitemap.

>> The next difference between our project and the Samples was that we   
>> have a local StyleSheet called 'woody.xsl' which includes the woody   
>> samples stylesheet thus:
>>
>>     <xsl:include   
>> href="context://samples/woody/resources/woody-samples-styling.xsl"/>
>>
>> Because we have some custom styled widgets.
>>
>> I switched this to load the 'woody-samples-styling.xsl' directly from  
>>  the sitemap, that made no difference either.
>>
>> Any suggestions as to what might be causing this?
>
>
> Have you tried declaring the "resources-uri" param in your main  
> stylesheet:
>  <xsl:param name="resources-uri">resources</xsl:param>

Thanks for the suggestion, but it does not solve the problem.

The only way I could make the error go away, was to remove all of the  
variable declarations from the XSLTs included by  
'woody-samples-styling.xsl', just leaving the one, top-level  
declaration.

I guess these XSLTs are designed to be used independently .... hence  
the repetition of the variable.

What I find rather weird, and slightly suspicious is that the Samples  
work and our Project does not, even though they are using the exact  
same XSLTs.


regards Jeremy

Re: [Woody] XSLT error

Posted by Sylvain Wallez <sy...@apache.org>.
Jeremy Quinn wrote:

> Hi All
>
> I had a project working with Woody.
> I just updated to the latest CVS and am having a strange problem:
>
> org.apache.cocoon.ProcessingException: Unable to get transformer  
> handler for  
> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
> samples/woody/resources/woody-samples-styling.xsl:  
> org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception in  
> creating Transform Handler
>
> cause: javax.xml.transform.TransformerException:  
> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
> samples/woody/resources/woody-field-styling.xsl: line 8: Variable  
> 'resources-uri' is multiply defined in the same scope.  
> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
> samples/woody/resources/woody-calendar-styling.xsl: line 8: Variable  
> 'resources-uri' is multiply defined in the same scope.  
> file:/Users/jerm/Development/Checkouts/Apache/cocoon-2.1/build/webapp/ 
> samples/woody/resources/woody-advanced-field-styling.xsl: line 8:  
> Variable 'resources-uri' is multiply defined in the same scope.
>
> The variable 'resources-uri' is indeed defined on each of these 
> XSLTs,  which is IMHO unnecessary.
>
> The strange thing is ..... I do not get this error with the Woody  
> Samples.
>
> First I looked to see if changing the Samples from using Xalan to 
> XSLTC  raised the problem (we have to use XSLTC because of the UTF 
> problems  with Xalan).


UTF problems in Xalan? Can you tell more about this?

> This had no effect.


You mean XSLTC runs the samples with no problem?

> The next difference between our project and the Samples was that we  
> have a local StyleSheet called 'woody.xsl' which includes the woody  
> samples stylesheet thus:
>
>     <xsl:include  
> href="context://samples/woody/resources/woody-samples-styling.xsl"/>
>
> Because we have some custom styled widgets.
>
> I switched this to load the 'woody-samples-styling.xsl' directly from  
> the sitemap, that made no difference either.
>
> Any suggestions as to what might be causing this?


Have you tried declaring the "resources-uri" param in your main stylesheet:
  <xsl:param name="resources-uri">resources</xsl:param>

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com