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/17 21:00:45 UTC

Odd or Even in the xsl-region-body

Hi,

I would like to know if it's possible to test the odd or even condition 
while writing in non-static content. Here's an example of what I want to 
do :

<fo:block font-size="13pt" 
          border-style="solid" 
          border-width="0pt"
          font-family="Helvetica Black"
          color="white">
  <xsl:if test="current_page='odd'">
    <xsl:attribute name="text-align">start</xsl:attribute>
  </xsl:if>
  <xsl:if test="current_page='even'">
    <xsl:attribute name="text-align">end</xsl:attribute>
  </xsl:if>
</fo:block>

You may have guessed it, I just wanna align my titles in function of the 
odd or even pages. How can I manage it ?

Cheers mates, and thanks for your help.

Simon Oualid
ARTE FRANCE
Developper

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


Re: Odd or Even in the xsl-region-body

Posted by Jeremias Maerki <de...@greenmail.ch>.
On 17.02.2003 22:05:18 s-oualid wrote:
> Thanks you for your answer mate ! 
> 
> I am so nervous on this project (because that's a totally new approach for 
> me, I was working with VPE's DLL of ideal software before I managed to 
> convince people here to use XSL:FO), that I am really happy to get some 
> help even if it doesn't really solve my problem ! :)=
> 
> I'd love to be in a perfect world with such miraculous properties ! ;)
> 
> Anyway, here's one of my tries about this problem ... But it looks like 
> being impossible to bind the <fo:page-number /> result into a variable.
> 
> <xsl:variable name="page_number"><fo:page-number /></xsl:variable>
> <xsl:if test="($page_number mod 2)=1">
>   <xsl:attribute name="text-align">start</xsl:attribute>
> </xsl:if>
> <xsl:if test="($page_number mod 2)=0">
>   <xsl:attribute name="text-align">end</xsl:attribute>
> </xsl:if>
> 
> I also tried to make a template with a page_number param but it doesn't 
> work either ...

Yes, because you have to be aware that XSLT happens before layout. FOP
only gets the XSL-FO, no XSLT stuff. You don't have control over
anything that goes on in FOP's layout process during XSLT. That's why I
said you have to control page breaking yourself if you want to
accomplish it in XSLT.

> In fact, I have no problem with a statical layout, like here :
> http://www.tatouage.fr/temp/cd_skin_example.pdf
> Because, in this skin, I have one odd and one even page for each XML 
> <FICHE> tag, so it's really easy to control page break in this case.
> 
> But on the other hand, I have skins like this one (my worst nightmare 
> actually) :
> http://www.tatouage.fr/temp/cd_skin_example.pdf
> And here, that's impossible for me to guess where I am, cause I control 
> page break with the keep-with-next properties... 
> 
> Thanks again for your help, that's really appreciated here ! :)

You're welcome. Good luck, I need to get some sleep now.

Jeremias Maerki


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


Re: Odd or Even in the xsl-region-body

Posted by Jeremias Maerki <de...@greenmail.ch>.
In an ideal world you would probably be using text-align="inside" and
text-align="outside". But that's not implemented in FOP AFAIK. The
approach you're trying to follow will only work if you try to do the
whole page-breaking stuff yourself in XSLT. But that could get real
messy and might not solve your problem. If I were you I would try to
alter the layout requirements. Maybe someone else has a good idea.

On 17.02.2003 21:00:45 s-oualid wrote:
> Hi,
> 
> I would like to know if it's possible to test the odd or even condition 
> while writing in non-static content. Here's an example of what I want to 
> do :
> 
> <fo:block font-size="13pt" 
>           border-style="solid" 
>           border-width="0pt"
>           font-family="Helvetica Black"
>           color="white">
>   <xsl:if test="current_page='odd'">
>     <xsl:attribute name="text-align">start</xsl:attribute>
>   </xsl:if>
>   <xsl:if test="current_page='even'">
>     <xsl:attribute name="text-align">end</xsl:attribute>
>   </xsl:if>
> </fo:block>
> 
> You may have guessed it, I just wanna align my titles in function of the 
> odd or even pages. How can I manage it ?
> 
> Cheers mates, and thanks for your help.


Jeremias Maerki


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


Re: New in rc2: Section heading is being repeated

Posted by Clay Leeds <cl...@medata.com>.
Roger,

Roger Roelofs wrote:
> Thanks!  In future I'll build test cases for questions to the list.  Is 
> there a way to get fop to save the .fo file it generates during the xslt 
> transform?

You've got the file xalan.bat (which does this for FOP) in your 
0.20.5rc2 root directory.

Just run this from the command line:

   xalan -in foo.xml -xsl foo.xsl -out foo.fo

(where foo.xml is the path to your XML file & foo.xsl is the path to 
your XSL file).

Brought to you by our friendly neighborhood FOP committers...

:-)

> On Tuesday, February 18, 2003, at 04:29  PM, J.Pietschmann wrote:
> 
>> Roger Roelofs wrote:
>>
>>> It's probably me...but since I installed 0.20.5rc2 my section 
>>> headings have been repeating at the top and bottom of the block in 
>>> the pdf.
>>
>> This was not intended. Well, in FOP it's not considered good styl
>> to mix text and block FO like tables like you did (read: you'll run
>> into bugs).
>>
>> As a workaround, put the text into its own block:
>>  <fo:block><xsl:value-of select="@id" /></fo:block>
>>
>> > Here's a fragment of the xsl file, and a fragment of the xml it 
>> operates
>> > on.
>> Usually, it is easier if a small but complete and self-contained
>> FO document was offered.
>>
>> J.Pietschmann


-- 
Clay Leeds - cleeds@medata.com
Web Developer - Medata, Inc. - http://www.medata.com
PGP Public Key: https://mail.medata.com/pgp/cleeds.asc


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


Re: New in rc2: Section heading is being repeated

Posted by Roger Roelofs <re...@datacompusa.com>.
Thanks!  In future I'll build test cases for questions to the list.  Is 
there a way to get fop to save the .fo file it generates during the 
xslt transform?

On Tuesday, February 18, 2003, at 04:29  PM, J.Pietschmann wrote:

> Roger Roelofs wrote:
>> It's probably me...but since I installed 0.20.5rc2 my section 
>> headings have been repeating at the top and bottom of the block in 
>> the pdf.
>
> This was not intended. Well, in FOP it's not considered good styl
> to mix text and block FO like tables like you did (read: you'll run
> into bugs).
>
> As a workaround, put the text into its own block:
>  <fo:block><xsl:value-of select="@id" /></fo:block>
>
> > Here's a fragment of the xsl file, and a fragment of the xml it 
> operates
> > on.
> Usually, it is easier if a small but complete and self-contained
> FO document was offered.
>
> J.Pietschmann
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>


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


Re: New in rc2: Section heading is being repeated

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Roger Roelofs wrote:
> It's probably me...but since I installed 0.20.5rc2 my section headings 
> have been repeating at the top and bottom of the block in the pdf.  

This was not intended. Well, in FOP it's not considered good styl
to mix text and block FO like tables like you did (read: you'll run
into bugs).

As a workaround, put the text into its own block:
  <fo:block><xsl:value-of select="@id" /></fo:block>

 > Here's a fragment of the xsl file, and a fragment of the xml it operates
 > on.
Usually, it is easier if a small but complete and self-contained
FO document was offered.

J.Pietschmann


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


Re: New in rc2: Section heading is being repeated

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Roger Roelofs wrote:
> It's probably me...but since I installed 0.20.5rc2 my section headings 
> have been repeating at the top and bottom of the block in the pdf.

This is fixed now in CVS.

J.Pietschmann



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


New in rc2: Section heading is being repeated

Posted by Roger Roelofs <re...@datacompusa.com>.
It's probably me...but since I installed 0.20.5rc2 my section headings 
have been repeating at the top and bottom of the block in the pdf.  
Here's a fragment of the xsl file, and a fragment of the xml it 
operates on.

Could someone better at fo tell me if it is my code or a change in fop?

xsl---------------
<xsl:template match="Section">
   <fo:block
           space-before="6pt"
           text-align="start"
           font-size="12pt"
           font-weight="bold" border=".2pt solid black">
     <xsl:value-of select="@id" />
     <fo:table table-layout="fixed" font-weight="normal">
       <fo:table-column column-width="40pt" />
       <fo:table-column column-width="30pt" />
       <fo:table-column column-width="200pt" />
       <fo:table-column column-width="250pt" />
       <fo:table-body>
         <xsl:apply-templates select="Item" />
       </fo:table-body>
     </fo:table>
   </fo:block>
</xsl:template>

xml-------------------
<Section id="Dwelling Condition">
	<Item id="lDCBldgPresent">
		<Label>Other Bldgs</Label>
		<Value>No</Value>
		<Score>0</Score>
	</Item>
	<Item id="lDCGaragePresent">
		<Label>Garage</Label>
		<Value>Yes</Value>
		<Score>0</Score>
	</Item>
</Section>

PDF output -----------
Dwelling Condition
0	Other Bldgs		No
0	Garage			Yes
Dwelling Condition     <---- this line is new as of today.
-----------------------
Thanks

Roger,

Roger Roelofs                          Phone 616 574-0480 x246
Datacomp Appraisal Services            Fax   616 574-0486
3215 Eaglecrest Drive, NE  Suite 100   email rer@datacompusa.com
Grand Rapids, MI  49525-4593           web   www.datacompusa.com


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