You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Steve Odlind <St...@TouchClarity.com> on 2007/01/15 16:45:21 UTC

How do I add a custom fo.xsl

Hi all,

 

How do I go about adding a custom fo.xsl in version 0.7? If I want a
particular PDF to have a different look-and-feel to the other files in
my site, how do I specify that this file should use a different fo.xsl
to the other files?

 

Having created the new fo.xsl, I have tried adding variants of the
following to my project sitemap.xmap:

 

""

<map:components>

...

   <map:serializers>

      <map:serializer name="fo2pdf"
src="org.apache.cocoon.serialization.FOPSerializer"
mime-type="application/pdf" />

    </map:serializers>

</map:components>

...

<map:match pattern="**aNewFile.xml">

      <map:generate src="{project:content.xdocs}{1} aNewFile.pdf" />

      <map:transform src="{project:resources}/myNewFile2fo.xsl" />

      <map:serialize type="fo2pdf" />

  </map:match>

""

 

... all to no avail, as I get a java.lang.NullPointerException when I
execute the 'forrest' command.

 

Could someone point me in the right direction, please?

 

Many thanks,

 

Steve


RE: How do I add a custom fo.xsl

Posted by Steve Odlind <St...@TouchClarity.com>.
Hi Thorsten,

>>Makes me think, looking at the common one I find
>>  <xsl:include href="pdfoutline.xsl"/>
>>  <xsl:include href="footerinfo.xsl"/>
>>did you still have this include and it get resolved correctly?

The include is still there, but not sure if it is resolved correctly
(attaching debug.log in case that will give you the info you need).

>>The error is not saying much. I need to see the fo and the xsl to
better
>>analyze the problem.

I have attached the .fo and XSL files. 

The file "correct-aNewFile.fo.txt" is the .fo produced when the PDF is
generated correctly (i.e. placed in
{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/document2fo.xsl and
no alterations made to sitemap.xmap). The file wrong-aNewFile.fo.txt is
the .fo produced when the PDF is not generated (placed in
{project:resources.stylesheets} and appropriate additions made to
sitemap.xmap), with the "No flow in page-sequence" error.

You will see that the first instance of the table not being generated
correctly is on line 1243 of wrong-aNewFile.fo.txt, where the table
begins with the <fo:table-row> element instead of the <table> element.
This is not the case in correct-aNewFile.fo.txt (see line 1243). This
table is generated by the <relinfo> template in myNewFile2fo.xsl (line
2480), which converts the attributes in a <relinfo> element in the xml
source file to a formatted table. All other templates below <relinfo>
are affected in the same way.

Hope this all makes sense.

Thanks again for all your help.

Steve 

-----Original Message-----
From: Thorsten Scherler
[mailto:thorsten.scherler.ext@juntadeandalucia.es] 
Sent: 17 January 2007 08:22
To: user@forrest.apache.org
Subject: RE: How do I add a custom fo.xsl

On Tue, 2007-01-16 at 16:44 +0000, Steve Odlind wrote:
> Hi Thorsten,
> 
> The PDF of this file is generated correctly when I place the new
fo.xsl
> file in 
> {properties:skins-dir}{forrest:forrest.skin}/xslt/fo/document2fo.xsl,
so
> I know there is nothing wrong with it. When I place this file in
> {project:resources.stylesheets}/myNewFile2fo.xsl, and add the
following
> to sitemap.xmap I get a "BROKEN: org.apache.fop.apps.FOPException: No
> flow in page-sequence" error (see attached error.log):

Makes me think, looking at the common one I find
  <xsl:include href="pdfoutline.xsl"/>
  <xsl:include href="footerinfo.xsl"/>
did you still have this include and it get resolved correctly?

The error is not saying much. I need to see the fo and the xsl to better
analyze the problem. 

> 
> <map:match pattern="**aNewFile.pdf">
>   <map:generate src="{project:content.xdocs}{1}aNewFile.xml" />
>   <map:transform
src="{project:resources.stylesheets}/myNewFile2fo.xsl"
> />
>   <map:serialize type="fo2pdf" />
> </map:match>
> 
> Looking at the .fo file, it seems that tables are not being assembled
> correctly:
> 

Hmm, you are on 0.7, right?

Have a look at
http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/common/xslt
/fo/document-to-fo.xsl?view=log

The two last commits may fix the problem. It happens if you use colspans
in your source documents but it is weird that if placed in 
{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/document2fo.xsl
it works fine. So it might not to be your problem.


> <fo:block background-color="#ffffff">
> 	<fo:table-row border-color="#ffffff" border-width="1mm"
> border-style="solid">
> 	<fo:table-cell border-color="#ffffff" border-width="0.5pt"
> border-style="solid" text-align="center" background-color="#0071b9"
> font-weight="bold" color="#FFFFFF" margin-end="4pt"
padding-after="3pt"
> padding-before="5pt" padding-end="2pt">
> <fo:block font-size="8pt" text-align="end">Version:</fo:block>
> </fo:table-cell>
> ...
> 
> For some reason, the <fo:table> and <fo:table-body> elements are being
> omitted. Is this why the "No flow in page-sequence" error is
generated?
> 

Yeah that definitely would lead to such an error.

Look in your <xsl:template match="table">, but my first guess is that
the includes are not resolved.

> Thanks for your continued help,
> 

your welcome, just keep on asking.

salu2

> Steve
> 
> 
> -----Original Message-----
> From: Thorsten Scherler
> [mailto:thorsten.scherler.ext@juntadeandalucia.es] 
> Sent: 16 January 2007 08:11
> To: user@forrest.apache.org
> Subject: RE: How do I add a custom fo.xsl
> 
> On Mon, 2007-01-15 at 18:31 +0000, Steve Odlind wrote: 
> > Hi Thorsten,
> > 
> > If I understand your suggestion correctly, ALL files in my site will
> use
> > the fo.xsl in the
> > {properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl
> > directory. Is that correct? 
> 
> Yes.
> 
> > If so, that's not quite what I wanted. I
> > would like just a few specified files to use the new fo.xsl.
> > 
> 
> Ok, I understand. Thanks for clarification.
> 
> > >> Hmm, not sure there is a space! {1} aNewFile.pdf That could cause
> the
> > >>error.
> > 
> > The space was a typo in the email, and not present in the source
file.
> > Sorry for the confusion.
> 
> No worries, just thought to point it out. 
> 
> > 
> > >> We would need some more information (stack trace) to see where
the
> > NPE
> > >>is coming from.
> > 
> > Please find the stack trace attached.
> 
> FATAL_E (2007-01-15) 18:12.18:658   [core.xslt-processor]
(Unknown-URI)
> Unknown-thread/TraxErrorHandler: Error in TraxTransformer:
>
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
> t2fo.xsl; Line 50; Column 59; 
> ; SystemID:
>
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
> t2fo.xsl; Line#: 50; Column#: 59
> javax.xml.transform.TransformerException:
java.lang.NullPointerException
> 
> As I understand it the file
>
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
> t2fo.xsl is throwing an exception at Line#: 50; Column#: 59. Makes me
> wonder what that might be.
> 
> I looked at your original mail again:
> On Mon, 2007-01-15 at 15:45 +0000, Steve Odlind wrote:
> > <map:match pattern="**aNewFile.xml">
> >       <map:generate src="{project:content.xdocs}{1} aNewFile.pdf" />
> >       <map:transform src="{project:resources}/myNewFile2fo.xsl" />
> >       <map:serialize type="fo2pdf" />
> >   </map:match>
> 
> The generator url is not valid (if you go with file naming
conventions).
> You are trying to generate SAX events from a binary file
> ({project:content.xdocs}{1}aNewFile.pdf). 
> 
> I think you want {project:content.xdocs}{1}aNewFile.xml and then e.g.
> request http://localhost:8888/index-aNewFile.pdf. This would then
> trigger your custom match with the file
> {project:content.xdocs}index-aNewFile.xml. 
> 
> Then you need to change it to something like:
> 
> <map:match pattern="**aNewFile.pdf">
>   <map:generate src="{project:content.xdocs}{1}aNewFile.xml" />
>   <map:transform src="{project:resources}/myNewFile2fo.xsl" />
>   <map:serialize type="fo2pdf" />
> </map:match>
> 
> That should work fine. Please try and report back.
> 
> HTH
> 
> salu2
> 


RE: How do I add a custom fo.xsl

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Tue, 2007-01-16 at 16:44 +0000, Steve Odlind wrote:
> Hi Thorsten,
> 
> The PDF of this file is generated correctly when I place the new fo.xsl
> file in 
> {properties:skins-dir}{forrest:forrest.skin}/xslt/fo/document2fo.xsl, so
> I know there is nothing wrong with it. When I place this file in
> {project:resources.stylesheets}/myNewFile2fo.xsl, and add the following
> to sitemap.xmap I get a "BROKEN: org.apache.fop.apps.FOPException: No
> flow in page-sequence" error (see attached error.log):

Makes me think, looking at the common one I find
  <xsl:include href="pdfoutline.xsl"/>
  <xsl:include href="footerinfo.xsl"/>
did you still have this include and it get resolved correctly?

The error is not saying much. I need to see the fo and the xsl to better
analyze the problem. 

> 
> <map:match pattern="**aNewFile.pdf">
>   <map:generate src="{project:content.xdocs}{1}aNewFile.xml" />
>   <map:transform src="{project:resources.stylesheets}/myNewFile2fo.xsl"
> />
>   <map:serialize type="fo2pdf" />
> </map:match>
> 
> Looking at the .fo file, it seems that tables are not being assembled
> correctly:
> 

Hmm, you are on 0.7, right?

Have a look at
http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/common/xslt/fo/document-to-fo.xsl?view=log

The two last commits may fix the problem. It happens if you use colspans
in your source documents but it is weird that if placed in 
{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/document2fo.xsl
it works fine. So it might not to be your problem.


> <fo:block background-color="#ffffff">
> 	<fo:table-row border-color="#ffffff" border-width="1mm"
> border-style="solid">
> 	<fo:table-cell border-color="#ffffff" border-width="0.5pt"
> border-style="solid" text-align="center" background-color="#0071b9"
> font-weight="bold" color="#FFFFFF" margin-end="4pt" padding-after="3pt"
> padding-before="5pt" padding-end="2pt">
> <fo:block font-size="8pt" text-align="end">Version:</fo:block>
> </fo:table-cell>
> ...
> 
> For some reason, the <fo:table> and <fo:table-body> elements are being
> omitted. Is this why the "No flow in page-sequence" error is generated?
> 

Yeah that definitely would lead to such an error.

Look in your <xsl:template match="table">, but my first guess is that
the includes are not resolved.

> Thanks for your continued help,
> 

your welcome, just keep on asking.

salu2

> Steve
> 
> 
> -----Original Message-----
> From: Thorsten Scherler
> [mailto:thorsten.scherler.ext@juntadeandalucia.es] 
> Sent: 16 January 2007 08:11
> To: user@forrest.apache.org
> Subject: RE: How do I add a custom fo.xsl
> 
> On Mon, 2007-01-15 at 18:31 +0000, Steve Odlind wrote: 
> > Hi Thorsten,
> > 
> > If I understand your suggestion correctly, ALL files in my site will
> use
> > the fo.xsl in the
> > {properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl
> > directory. Is that correct? 
> 
> Yes.
> 
> > If so, that's not quite what I wanted. I
> > would like just a few specified files to use the new fo.xsl.
> > 
> 
> Ok, I understand. Thanks for clarification.
> 
> > >> Hmm, not sure there is a space! {1} aNewFile.pdf That could cause
> the
> > >>error.
> > 
> > The space was a typo in the email, and not present in the source file.
> > Sorry for the confusion.
> 
> No worries, just thought to point it out. 
> 
> > 
> > >> We would need some more information (stack trace) to see where the
> > NPE
> > >>is coming from.
> > 
> > Please find the stack trace attached.
> 
> FATAL_E (2007-01-15) 18:12.18:658   [core.xslt-processor] (Unknown-URI)
> Unknown-thread/TraxErrorHandler: Error in TraxTransformer:
> file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
> t2fo.xsl; Line 50; Column 59; 
> ; SystemID:
> file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
> t2fo.xsl; Line#: 50; Column#: 59
> javax.xml.transform.TransformerException: java.lang.NullPointerException
> 
> As I understand it the file
> file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
> t2fo.xsl is throwing an exception at Line#: 50; Column#: 59. Makes me
> wonder what that might be.
> 
> I looked at your original mail again:
> On Mon, 2007-01-15 at 15:45 +0000, Steve Odlind wrote:
> > <map:match pattern="**aNewFile.xml">
> >       <map:generate src="{project:content.xdocs}{1} aNewFile.pdf" />
> >       <map:transform src="{project:resources}/myNewFile2fo.xsl" />
> >       <map:serialize type="fo2pdf" />
> >   </map:match>
> 
> The generator url is not valid (if you go with file naming conventions).
> You are trying to generate SAX events from a binary file
> ({project:content.xdocs}{1}aNewFile.pdf). 
> 
> I think you want {project:content.xdocs}{1}aNewFile.xml and then e.g.
> request http://localhost:8888/index-aNewFile.pdf. This would then
> trigger your custom match with the file
> {project:content.xdocs}index-aNewFile.xml. 
> 
> Then you need to change it to something like:
> 
> <map:match pattern="**aNewFile.pdf">
>   <map:generate src="{project:content.xdocs}{1}aNewFile.xml" />
>   <map:transform src="{project:resources}/myNewFile2fo.xsl" />
>   <map:serialize type="fo2pdf" />
> </map:match>
> 
> That should work fine. Please try and report back.
> 
> HTH
> 
> salu2
> 


RE: How do I add a custom fo.xsl

Posted by Steve Odlind <St...@TouchClarity.com>.
Hi Thorsten,

The PDF of this file is generated correctly when I place the new fo.xsl
file in 
{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/document2fo.xsl, so
I know there is nothing wrong with it. When I place this file in
{project:resources.stylesheets}/myNewFile2fo.xsl, and add the following
to sitemap.xmap I get a "BROKEN: org.apache.fop.apps.FOPException: No
flow in page-sequence" error (see attached error.log):

<map:match pattern="**aNewFile.pdf">
  <map:generate src="{project:content.xdocs}{1}aNewFile.xml" />
  <map:transform src="{project:resources.stylesheets}/myNewFile2fo.xsl"
/>
  <map:serialize type="fo2pdf" />
</map:match>

Looking at the .fo file, it seems that tables are not being assembled
correctly:

<fo:block background-color="#ffffff">
	<fo:table-row border-color="#ffffff" border-width="1mm"
border-style="solid">
	<fo:table-cell border-color="#ffffff" border-width="0.5pt"
border-style="solid" text-align="center" background-color="#0071b9"
font-weight="bold" color="#FFFFFF" margin-end="4pt" padding-after="3pt"
padding-before="5pt" padding-end="2pt">
<fo:block font-size="8pt" text-align="end">Version:</fo:block>
</fo:table-cell>
...

For some reason, the <fo:table> and <fo:table-body> elements are being
omitted. Is this why the "No flow in page-sequence" error is generated?

Thanks for your continued help,

Steve


-----Original Message-----
From: Thorsten Scherler
[mailto:thorsten.scherler.ext@juntadeandalucia.es] 
Sent: 16 January 2007 08:11
To: user@forrest.apache.org
Subject: RE: How do I add a custom fo.xsl

On Mon, 2007-01-15 at 18:31 +0000, Steve Odlind wrote: 
> Hi Thorsten,
> 
> If I understand your suggestion correctly, ALL files in my site will
use
> the fo.xsl in the
> {properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl
> directory. Is that correct? 

Yes.

> If so, that's not quite what I wanted. I
> would like just a few specified files to use the new fo.xsl.
> 

Ok, I understand. Thanks for clarification.

> >> Hmm, not sure there is a space! {1} aNewFile.pdf That could cause
the
> >>error.
> 
> The space was a typo in the email, and not present in the source file.
> Sorry for the confusion.

No worries, just thought to point it out. 

> 
> >> We would need some more information (stack trace) to see where the
> NPE
> >>is coming from.
> 
> Please find the stack trace attached.

FATAL_E (2007-01-15) 18:12.18:658   [core.xslt-processor] (Unknown-URI)
Unknown-thread/TraxErrorHandler: Error in TraxTransformer:
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
t2fo.xsl; Line 50; Column 59; 
; SystemID:
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
t2fo.xsl; Line#: 50; Column#: 59
javax.xml.transform.TransformerException: java.lang.NullPointerException

As I understand it the file
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/documen
t2fo.xsl is throwing an exception at Line#: 50; Column#: 59. Makes me
wonder what that might be.

I looked at your original mail again:
On Mon, 2007-01-15 at 15:45 +0000, Steve Odlind wrote:
> <map:match pattern="**aNewFile.xml">
>       <map:generate src="{project:content.xdocs}{1} aNewFile.pdf" />
>       <map:transform src="{project:resources}/myNewFile2fo.xsl" />
>       <map:serialize type="fo2pdf" />
>   </map:match>

The generator url is not valid (if you go with file naming conventions).
You are trying to generate SAX events from a binary file
({project:content.xdocs}{1}aNewFile.pdf). 

I think you want {project:content.xdocs}{1}aNewFile.xml and then e.g.
request http://localhost:8888/index-aNewFile.pdf. This would then
trigger your custom match with the file
{project:content.xdocs}index-aNewFile.xml. 

Then you need to change it to something like:

<map:match pattern="**aNewFile.pdf">
  <map:generate src="{project:content.xdocs}{1}aNewFile.xml" />
  <map:transform src="{project:resources}/myNewFile2fo.xsl" />
  <map:serialize type="fo2pdf" />
</map:match>

That should work fine. Please try and report back.

HTH

salu2


RE: How do I add a custom fo.xsl

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Mon, 2007-01-15 at 18:31 +0000, Steve Odlind wrote: 
> Hi Thorsten,
> 
> If I understand your suggestion correctly, ALL files in my site will use
> the fo.xsl in the
> {properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl
> directory. Is that correct? 

Yes.

> If so, that's not quite what I wanted. I
> would like just a few specified files to use the new fo.xsl.
> 

Ok, I understand. Thanks for clarification.

> >> Hmm, not sure there is a space! {1} aNewFile.pdf That could cause the
> >>error.
> 
> The space was a typo in the email, and not present in the source file.
> Sorry for the confusion.

No worries, just thought to point it out. 

> 
> >> We would need some more information (stack trace) to see where the
> NPE
> >>is coming from.
> 
> Please find the stack trace attached.

FATAL_E (2007-01-15) 18:12.18:658   [core.xslt-processor] (Unknown-URI)
Unknown-thread/TraxErrorHandler: Error in TraxTransformer:
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/document2fo.xsl; Line 50; Column 59; 
; SystemID:
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/document2fo.xsl; Line#: 50; Column#: 59
javax.xml.transform.TransformerException: java.lang.NullPointerException

As I understand it the file
file:/C:/docs/documentation/src/documentation/skins/pelt/xslt/fo/document2fo.xsl is throwing an exception at Line#: 50; Column#: 59. Makes me wonder what that might be.

I looked at your original mail again:
On Mon, 2007-01-15 at 15:45 +0000, Steve Odlind wrote:
> <map:match pattern="**aNewFile.xml">
>       <map:generate src="{project:content.xdocs}{1} aNewFile.pdf" />
>       <map:transform src="{project:resources}/myNewFile2fo.xsl" />
>       <map:serialize type="fo2pdf" />
>   </map:match>

The generator url is not valid (if you go with file naming conventions).
You are trying to generate SAX events from a binary file
({project:content.xdocs}{1}aNewFile.pdf). 

I think you want {project:content.xdocs}{1}aNewFile.xml and then e.g.
request http://localhost:8888/index-aNewFile.pdf. This would then
trigger your custom match with the file
{project:content.xdocs}index-aNewFile.xml. 

Then you need to change it to something like:

<map:match pattern="**aNewFile.pdf">
  <map:generate src="{project:content.xdocs}{1}aNewFile.xml" />
  <map:transform src="{project:resources}/myNewFile2fo.xsl" />
  <map:serialize type="fo2pdf" />
</map:match>

That should work fine. Please try and report back.

HTH

salu2


RE: How do I add a custom fo.xsl

Posted by Steve Odlind <St...@TouchClarity.com>.
Hi Thorsten,

If I understand your suggestion correctly, ALL files in my site will use
the fo.xsl in the
{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl
directory. Is that correct? If so, that's not quite what I wanted. I
would like just a few specified files to use the new fo.xsl.

>> Hmm, not sure there is a space! {1} aNewFile.pdf That could cause the
>>error.

The space was a typo in the email, and not present in the source file.
Sorry for the confusion.

>> We would need some more information (stack trace) to see where the
NPE
>>is coming from.

Please find the stack trace attached.

Thanks,

Steve

-----Original Message-----
From: Thorsten Scherler
[mailto:thorsten.scherler.ext@juntadeandalucia.es] 
Sent: 15 January 2007 16:01
To: user@forrest.apache.org
Subject: Re: How do I add a custom fo.xsl

On Mon, 2007-01-15 at 15:45 +0000, Steve Odlind wrote:
> Hi all,
> 
>  
> 
> How do I go about adding a custom fo.xsl in version 0.7? If I want a
> particular PDF to have a different look-and-feel to the other files in
> my site, how do I specify that this file should use a different fo.xsl
> to the other files?
> 

The locationmap is letting you override the default one with your own
implementation:
from main/webapp/locationmap-transform.xml
<match pattern="transform.*.fo">
      <select>
        <location
src="{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl"
/>
        <location
src="{forrest:forrest.context}/skins/{forrest:forrest.skin}/xslt/fo/{1}-
to-fo.xsl"/>
        <location
src="{forrest:forrest.context}/skins/common/xslt/fo/{1}-to-fo.xsl"/>
      </select>
    </match>

Meaning if you place your xsl in 
{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl
then it get preference over the default ones.

> 
> Having created the new fo.xsl, I have tried adding variants of the
> following to my project sitemap.xmap:
> 
>  
> 
> ""
> 
> <map:components>
> 
> ...
> 
>    <map:serializers>
> 
>       <map:serializer name="fo2pdf"
> src="org.apache.cocoon.serialization.FOPSerializer"
> mime-type="application/pdf" />
> 
>     </map:serializers>
> 
> </map:components>
> 
> ...
> 
> <map:match pattern="**aNewFile.xml">
> 
>       <map:generate src="{project:content.xdocs}{1} aNewFile.pdf" />

Hmm, not sure there is a space! {1} aNewFile.pdf 
That could cause the error.

> 
>       <map:transform src="{project:resources}/myNewFile2fo.xsl" />
> 
>       <map:serialize type="fo2pdf" />
> 
>   </map:match>
> 
> ""
> 
>  
> 
> ... all to no avail, as I get a java.lang.NullPointerException when I
> execute the 'forrest' command.

We would need some more information (stack trace) to see where the NPE
is coming from.

HTH

> 
>  
> 
> Could someone point me in the right direction, please?
> 
>  
> 
> Many thanks,
> 
>  
> 
> Steve
> 
> 


Re: How do I add a custom fo.xsl

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Mon, 2007-01-15 at 15:45 +0000, Steve Odlind wrote:
> Hi all,
> 
>  
> 
> How do I go about adding a custom fo.xsl in version 0.7? If I want a
> particular PDF to have a different look-and-feel to the other files in
> my site, how do I specify that this file should use a different fo.xsl
> to the other files?
> 

The locationmap is letting you override the default one with your own
implementation:
from main/webapp/locationmap-transform.xml
<match pattern="transform.*.fo">
      <select>
        <location
src="{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl" />
        <location
src="{forrest:forrest.context}/skins/{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl"/>
        <location
src="{forrest:forrest.context}/skins/common/xslt/fo/{1}-to-fo.xsl"/>
      </select>
    </match>

Meaning if you place your xsl in 
{properties:skins-dir}{forrest:forrest.skin}/xslt/fo/{1}-to-fo.xsl
then it get preference over the default ones.

> 
> Having created the new fo.xsl, I have tried adding variants of the
> following to my project sitemap.xmap:
> 
>  
> 
> “”
> 
> <map:components>
> 
> …
> 
>    <map:serializers>
> 
>       <map:serializer name="fo2pdf"
> src="org.apache.cocoon.serialization.FOPSerializer"
> mime-type="application/pdf" />
> 
>     </map:serializers>
> 
> </map:components>
> 
> …
> 
> <map:match pattern="**aNewFile.xml">
> 
>       <map:generate src="{project:content.xdocs}{1} aNewFile.pdf" />

Hmm, not sure there is a space! {1} aNewFile.pdf 
That could cause the error.

> 
>       <map:transform src="{project:resources}/myNewFile2fo.xsl" />
> 
>       <map:serialize type="fo2pdf" />
> 
>   </map:match>
> 
> “”
> 
>  
> 
> … all to no avail, as I get a java.lang.NullPointerException when I
> execute the ‘forrest’ command.

We would need some more information (stack trace) to see where the NPE
is coming from.

HTH

> 
>  
> 
> Could someone point me in the right direction, please?
> 
>  
> 
> Many thanks,
> 
>  
> 
> Steve
> 
>