You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by s-...@artefrance.fr on 2003/02/18 20:22:40 UTC

As expected, questions about fo:marker usage

Hi mates !

That's crazy, I was trying today to implement the <fo:marker> tag to solve 
my title problem, running fop-0.20.4, but I had NullPointerException at 
runtime (see bellow). I was about to write you one of my "borring mail" ;) 
but I decided to try with the new 0.20.5rc2 before annoying you... 

I tested on my workstation (using .bat in debug mode), ok, then I put 
(please notice the right use of the irregular verb, thanks to J.Pietschmann ;)) this 0.20.5rc2 in our apache/tomcat server and it's 
working perfectly with this version of fop !

I have no more problem... 

I pasted the mail I was writing before trying the rc2 bellow ! I hope 
that's not totally useless, if that's the case, just excuse me (again) for 
posting.

In fact, it stays one question... How can I test the value of a 
<fo:retrieve-marker retrieve-class-name="theme" /> tag (I understood now 
that it is not evaluated by the same process than the xsl stylesheet) ? 

I have to write a border with text from top to bottom, and the 
'writing-mode' properties is not implemented yet, so I just want to use a 
graphic to do that, but I need to test the marker value to choose the 
right graphic. 

Is that possible, or should I use something like another XSL 
transformation to put a &#160; after each character ?

Thanks again mates, I hope I'll be able to help people here like you help 
me soon.

Simon


----------------------------------------------------------------------------------------
-- Example of <fo:marker> usage working with 0.20.5rc2 but not with 0.20.4 
!
----------------------------------------------------------------------------------------

Here's the extracts from my xsl stylesheet :

My page sequence :

<fo:page-sequence-master master-name="document">
  <fo:repeatable-page-master-alternatives>
    <fo:conditional-page-master-reference odd-or-even="even" 
master-reference="even"/>
    <fo:conditional-page-master-reference odd-or-even="odd" 
master-reference="odd"/>
  </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

My static content on the even pages :

<fo:static-content flow-name="margin-even">
  <fo:table table-layout="fixed">
    <fo:table-column column-width="6mm" />
    <fo:table-body>
      <fo:table-row height="297mm">
        <fo:table-cell border-style="solid" border-width="0pt" 
background-color="#CECCCB">
          <fo:block>
            <fo:retrieve-marker retrieve-class-name="theme" />
          </fo:block> 
        </fo:table-cell>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
</fo:static-content>

Here's my body :

<fo:flow flow-name="xsl-region-body">
  <xsl:apply-templates select="FICHE">
    <xsl:sort select="SOUSTHEME" />
  </xsl:apply-templates>
</fo:flow> 

In my FICHE template, I have this tag for all titles : 
<xsl:apply-templates select="TITRE" />.
This is the template where I set the <fo:marker> to the current TITLE :

<xsl:template match="TITRE">
  <fo:marker marker-class-name="theme">
       <fo:block>
         <xsl:value-of select="."/> 
       </fo:block>
  </fo:marker>
  <fo:block font-size="13pt" 
            border-style="solid" 
            border-width="0pt"
            font-family="Helvetica Black"
            text-align="end"
            color="white">
    <xsl:value-of select="." />
  </fo:block>
  <xsl:apply-templates />
</xsl:template>


Here's the error returned by Tomcat in run mode :

java.lang.RuntimeException: java.lang.NullPointerException
        at 
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3231)
        at java.lang.Thread.run(Thread.java:484)

I am currently running FOP 0.20.4 with the 1.3.1_04 JDK.

Many thanks for your help, I hope I was clear enought.

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: As expected, questions about fo:marker usage

Posted by Roland Neilands <rn...@pulsemining.com.au>.
Simon,

> In fact, it stays one question... How can I test the value of a
> <fo:retrieve-marker retrieve-class-name="theme" /> tag (I
> understood now
> that it is not evaluated by the same process than the xsl
> stylesheet) ?
>
> I have to write a border with text from top to bottom, and the
> 'writing-mode' properties is not implemented yet, so I just
> want to use a
> graphic to do that, but I need to test the marker value to choose the
> right graphic.

Put the graphic in the marker, ie test happens before assignment, not
retrieval
Block formatting is applied on assignment, but the graphic must be small
enough to fit in the block containing the retrieve (ie use height & width)
or nothing is displayed.

eg. bastardised a table continued marker to test it worked (0.20.5rc2):

      <fo:block line-height="15pt">
        <fo:marker marker-class-name="table-continued">
              <xsl:variable name="sign">
                <xsl:value-of select="Header/sign"/>
              </xsl:variable>
          <fo:external-graphic src="file:images/{$sign}" height="10pt"/>
        </fo:marker>
      </fo:block>


        <fo:block height="15pt">
          fo:retrieve-marker retrieve-class-name="table-continued"
                              retrieve-boundary="page"
                              retrieve-position="last-ending-within-page"/>
        </fo:block>

>
> Is that possible, or should I use something like another XSL
> transformation to put a &#160; after each character ?
That would probably work too & would be simpler to convert when it is
implemented. Up to you.

Cheers,
Roland




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org