You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by sj...@apache.org on 2008/07/03 11:15:49 UTC

svn commit: r673630 - /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Author: sjur
Date: Thu Jul  3 02:15:48 2008
New Revision: 673630

URL: http://svn.apache.org/viewvc?rev=673630&view=rev
Log:
The font-family params defined in document-to-fo.xsl were NOT available to this stylesheet, even though it is included after the param definitions.

I have thus added the param definitions here as well, to make the pdf generation in Dispatcher work again, but this is really a cludge that goes against the idea of putting the font-family specifications into params/variables instead of as hard-coded strings.

Anyway, pdf generation in Dispatcher is working again.

Modified:
    forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl?rev=673630&r1=673629&r2=673630&view=diff
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl Thu Jul  3 02:15:48 2008
@@ -18,6 +18,17 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
 
+<!-- Font-family variables defined here: -->
+  <xsl:param
+        name="sans-serif"
+        select="'sans-serif'" />
+  <xsl:param
+        name="serif"
+        select="'serif'" />
+  <xsl:param
+        name="monospace"
+        select="'monospace'" />
+
   <xsl:include href="lm://transform.xml.pathutils"/>
 
   <xsl:template match="anchor">



Re: svn commit: r673630 - /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Posted by Sjur Moshagen <sj...@mac.com>.
Den 3. jul. 2008 kl. 14.01 skrev Sjur Moshagen:

> Den 3. jul. 2008 kl. 12.33 skrev Thorsten Scherler:
>
>> Hmm, not sure but did you try a xsl:import instead and not defining  
>> the
>> variables again. That should work.
>
> Did try now - same result. To me this looks like something is  
> blocking the include/import - this *ought to* work. I'm out of ideas  
> at the moment.

This is clearly a bug somewhere. According to the specs, the included  
(and also imported) stylesheet should in effect be treated as if it  
where part of the text of the including stylesheet:

"The inclusion works at the XML tree level. The resource located by  
the href attribute value is parsed as an XML document, and the  
children of the xsl:stylesheet element in this document replace the  
xsl:include element in the including document."[1]

But the behaviour observed is not in accordance with this.

Also, it seems that only variable and param definitions are affected -  
regular template rules work as they should.

Sjur

[1] http://www.w3.org/TR/xslt#include


Re: svn commit: r673630 - /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Posted by Sjur Moshagen <sj...@mac.com>.
Den 3. jul. 2008 kl. 12.33 skrev Thorsten Scherler:

> Hmm, not sure but did you try a xsl:import instead and not defining  
> the
> variables again. That should work.

Did try now - same result. To me this looks like something is blocking  
the include/import - this *ought to* work. I'm out of ideas at the  
moment.

Sjur


Re: svn commit: r673630 - /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Thu, 2008-07-03 at 12:26 +0300, Sjur Moshagen wrote:
> Hello,
> 
> Anybody able to help me? I thought that the following in document-to- 
> fo.xsl:
> 
>    <xsl:variable
>          name="sans-serif"
>          select="'sans-serif'" />
>    <xsl:variable
>          name="serif"
>          select="'serif'" />
>    <xsl:variable
>          name="monospace"
>          select="'monospace'" />
> ...
>    <xsl:include
>          href="helper-commonElements.xsl" />


Hmm, not sure but did you try a xsl:import instead and not defining the
variables again. That should work.

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: svn commit: r673630 - /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Posted by Sjur Moshagen <sj...@mac.com>.
Den 3. jul. 2008 kl. 15.29 skrev Sjur Moshagen:

>> Reading this error it seems that there is a logical error.
>
> I agree, but I can't see where...
>
>> The contract "content-main" is not defining this variables neither do
>> helper-commonElements.xsl this explains why the forrestbot fails.
>
> Are you saying that helper-commonElements.xsl is called/included  
> *outside of* or *independent from* document-to-fo.xsl? That would of  
> course explain the behaviour.

Found it, and corrected the code. See r673684.

(Still new in the dispatcher world...)

Best regards,
Sjur


Re: svn commit: r673630 - /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Posted by Sjur Moshagen <sj...@mac.com>.
Den 3. jul. 2008 kl. 15.12 skrev Thorsten Scherler:

> On Thu, 2008-07-03 at 12:26 +0300, Sjur Moshagen wrote:
>> Hello,
>>
>> Anybody able to help me? I thought that the following in document-to-
>> fo.xsl:
>>
>>   <xsl:variable
>>         name="sans-serif"
>>         select="'sans-serif'" />
>>   <xsl:variable
>>         name="serif"
>>         select="'serif'" />
>>   <xsl:variable
>>         name="monospace"
>>         select="'monospace'" />
>> ...
>>   <xsl:include
>>         href="helper-commonElements.xsl" />
>>
>>
>> would automatically make the variables/params (I have tested both, no
>> difference) available to helper-commonElements.xsl, but no. How come?
>
> Hmm, I do not understand.

forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/ 
stylesheets/document-to-fo.xsl

does already contain an inclusion of helper-commonElements.xsl, as  
showed above. I didn't see any other place where helper- 
commonElements.xsl would be included or called, thus I thought that by  
adding the variables to document-to-fo.xsl would make them available  
also to helper-commonElements.xsl. But I was apparently mistaken:)

> BUT:
> On Thu, 2008-07-03 at 10:08 +0000, Forrestbot@forrest.zones.apache.org
> wrote:
> [java]
> file:/export/opt/forrest-trunk/build/plugins/ 
> org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper- 
> commonElements.xsl; Line #35; Column #94;  
> org.apache.xml.utils.WrappedRuntimeException: Could not find  
> variable with the name of sans-serif
>>     [java] X [0]
> samples-b/sample.pdf      BROKEN: dispatcherError: 500 - Internal  
> server
> error
>>     [java] The contract "content-main" has thrown an exception by
> resolving the implementation from
> "cocoon://resolve.contract.fo.content-main".
>>     [java]
>>     [java] dispatcherErrorStack:
>>     [java] org.apache.forrest.dispatcher.DispatcherException: 500 -
> Internal server error
>>     [java] component: ContractBean
>>     [java] message:
>>     [java] Could not setup transformer in the contractBean.
>>     [java] Please check that the contract implementation is
> wellformed and valid!
>>     [java]
>>     [java] One reason that an implementation may not be valid is that
> you are using variables that cannot be resolved.
>>     [java] Please see the logs and the sysout for more information,
> you may are see right away the error.
>
>
> Reading this error it seems that there is a logical error.

I agree, but I can't see where...

> The contract "content-main" is not defining this variables neither do
> helper-commonElements.xsl this explains why the forrestbot fails.

Are you saying that helper-commonElements.xsl is called/included  
*outside of* or *independent from* document-to-fo.xsl? That would of  
course explain the behaviour.

My ultimate goal is to move the whole font-family specification to a  
configuration file (skinconf + the relevant place for dispatcher -  
where would that be?), but I wanted to make sure that the variables  
were working fine before I took the next step.

Best regards,
Sjur


Re: svn commit: r673630 - /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Thu, 2008-07-03 at 12:26 +0300, Sjur Moshagen wrote:
> Hello,
> 
> Anybody able to help me? I thought that the following in document-to- 
> fo.xsl:
> 
>    <xsl:variable
>          name="sans-serif"
>          select="'sans-serif'" />
>    <xsl:variable
>          name="serif"
>          select="'serif'" />
>    <xsl:variable
>          name="monospace"
>          select="'monospace'" />
> ...
>    <xsl:include
>          href="helper-commonElements.xsl" />
> 
> 
> would automatically make the variables/params (I have tested both, no  
> difference) available to helper-commonElements.xsl, but no. How come?

Hmm, I do not understand.

BUT:
On Thu, 2008-07-03 at 10:08 +0000, Forrestbot@forrest.zones.apache.org
wrote:
[java]
file:/export/opt/forrest-trunk/build/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl; Line #35; Column #94; org.apache.xml.utils.WrappedRuntimeException: Could not find variable with the name of sans-serif
>      [java] X [0]
samples-b/sample.pdf      BROKEN: dispatcherError: 500 - Internal server
error
>      [java] The contract "content-main" has thrown an exception by
resolving the implementation from
"cocoon://resolve.contract.fo.content-main".
>      [java] 
>      [java] dispatcherErrorStack:
>      [java] org.apache.forrest.dispatcher.DispatcherException: 500 -
Internal server error
>      [java] component: ContractBean
>      [java] message:
>      [java] Could not setup transformer in the contractBean.
>      [java] Please check that the contract implementation is
wellformed and valid!
>      [java] 
>      [java] One reason that an implementation may not be valid is that
you are using variables that cannot be resolved.
>      [java] Please see the logs and the sysout for more information,
you may are see right away the error.


Reading this error it seems that there is a logical error. 

The contract "content-main" is not defining this variables neither do
helper-commonElements.xsl this explains why the forrestbot fails.

salu2

> 
> And sorry for the extra noise, I tested without restarting forrest,  
> and it seemed to work fine. But stopping forrest, then forrest clean,  
> then forrest run again displayed the problem. I assume that there's  
> some caching things going on with pdf that makes the edit - reload  
> cycle unreliable.
> 
> Best regards,
> Sjur
> 
> Den 3. jul. 2008 kl. 12.15 skrev sjur@apache.org:
> 
> > Author: sjur
> > Date: Thu Jul  3 02:15:48 2008
> > New Revision: 673630
> >
> > URL: http://svn.apache.org/viewvc?rev=673630&view=rev
> > Log:
> > The font-family params defined in document-to-fo.xsl were NOT  
> > available to this stylesheet, even though it is included after the  
> > param definitions.
> >
> > I have thus added the param definitions here as well, to make the  
> > pdf generation in Dispatcher work again, but this is really a cludge  
> > that goes against the idea of putting the font-family specifications  
> > into params/variables instead of as hard-coded strings.
> >
> > Anyway, pdf generation in Dispatcher is working again.
> >
> > Modified:
> >    forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/ 
> > resources/stylesheets/helper-commonElements.xsl
> >
> > Modified: forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/ 
> > resources/stylesheets/helper-commonElements.xsl
> > URL: http://svn.apache.org/viewvc/forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl?rev=673630&r1=673629&r2=673630&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/ 
> > resources/stylesheets/helper-commonElements.xsl (original)
> > +++ forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/ 
> > resources/stylesheets/helper-commonElements.xsl Thu Jul  3 02:15:48  
> > 2008
> > @@ -18,6 +18,17 @@
> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >   xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
> >
> > +<!-- Font-family variables defined here: -->
> > +  <xsl:param
> > +        name="sans-serif"
> > +        select="'sans-serif'" />
> > +  <xsl:param
> > +        name="serif"
> > +        select="'serif'" />
> > +  <xsl:param
> > +        name="monospace"
> > +        select="'monospace'" />
> > +
> >   <xsl:include href="lm://transform.xml.pathutils"/>
> >
> >   <xsl:template match="anchor">
> >
> >
> 
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: svn commit: r673630 - /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Posted by Sjur Moshagen <sj...@mac.com>.
Hello,

Anybody able to help me? I thought that the following in document-to- 
fo.xsl:

   <xsl:variable
         name="sans-serif"
         select="'sans-serif'" />
   <xsl:variable
         name="serif"
         select="'serif'" />
   <xsl:variable
         name="monospace"
         select="'monospace'" />
...
   <xsl:include
         href="helper-commonElements.xsl" />


would automatically make the variables/params (I have tested both, no  
difference) available to helper-commonElements.xsl, but no. How come?

And sorry for the extra noise, I tested without restarting forrest,  
and it seemed to work fine. But stopping forrest, then forrest clean,  
then forrest run again displayed the problem. I assume that there's  
some caching things going on with pdf that makes the edit - reload  
cycle unreliable.

Best regards,
Sjur

Den 3. jul. 2008 kl. 12.15 skrev sjur@apache.org:

> Author: sjur
> Date: Thu Jul  3 02:15:48 2008
> New Revision: 673630
>
> URL: http://svn.apache.org/viewvc?rev=673630&view=rev
> Log:
> The font-family params defined in document-to-fo.xsl were NOT  
> available to this stylesheet, even though it is included after the  
> param definitions.
>
> I have thus added the param definitions here as well, to make the  
> pdf generation in Dispatcher work again, but this is really a cludge  
> that goes against the idea of putting the font-family specifications  
> into params/variables instead of as hard-coded strings.
>
> Anyway, pdf generation in Dispatcher is working again.
>
> Modified:
>    forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/ 
> resources/stylesheets/helper-commonElements.xsl
>
> Modified: forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/ 
> resources/stylesheets/helper-commonElements.xsl
> URL: http://svn.apache.org/viewvc/forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl?rev=673630&r1=673629&r2=673630&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/ 
> resources/stylesheets/helper-commonElements.xsl (original)
> +++ forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/ 
> resources/stylesheets/helper-commonElements.xsl Thu Jul  3 02:15:48  
> 2008
> @@ -18,6 +18,17 @@
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
>
> +<!-- Font-family variables defined here: -->
> +  <xsl:param
> +        name="sans-serif"
> +        select="'sans-serif'" />
> +  <xsl:param
> +        name="serif"
> +        select="'serif'" />
> +  <xsl:param
> +        name="monospace"
> +        select="'monospace'" />
> +
>   <xsl:include href="lm://transform.xml.pathutils"/>
>
>   <xsl:template match="anchor">
>
>