xml - How can I prevent text from going over the before and after regions using xsl-fo? -


i'm loading allot of text pdf using xsl-fo. when loads fills page entirely border border. there way prevent text being able go on before, after, start , end blocks, or should put margins on blocks containing text?

<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0" xmlns:fo="http://www.w3.org/1999/xsl/format"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/">     <fo:root>         <!-- overall layout -->         <fo:layout-master-set>             <fo:simple-page-master master-name="forsalepage">                 <fo:region-body/>                 <fo:region-before   extent="1in" background-color="#0000ff" />                 <fo:region-after    extent="1in" background-color="#0000ff" />                 <fo:region-start/>                 <fo:region-end/>             </fo:simple-page-master>         </fo:layout-master-set>          <!-- page content -->         <xsl:for-each select="ovgs/forsale/game">             <fo:page-sequence master-reference="forsalepage">                 <fo:flow flow-name="xsl-region-body">                     <fo:block text-align="center" margin-top="0.1in">pros:</fo:block>                     <xsl:for-each select="review/pros/pro">                         <fo:block text-align="center">-<xsl:value-of select="." /></fo:block>                     </xsl:for-each>                     <fo:block text-align="center" margin-top="0.1in">cons:</fo:block>                     <xsl:for-each select="review/cons/con">                         <fo:block text-align="center">-<xsl:value-of select="." /></fo:block>                     </xsl:for-each>                     <fo:block page-break-before="always" margin-top="1.1in" margin-right="1in" margin-left="1in">content:</fo:block>                     <xsl:for-each select="review/content/*">                         <xsl:choose>                             <xsl:when test=". = not(node())">                                 <fo:block margin-top="0.1in" margin-right="1in" margin-left="1in"><xsl:value-of select="./preceding::text()[1]" /></fo:block>                             </xsl:when>                             <xsl:when test=". = text()">                                 <fo:block text-align="center" margin-top="0.1in"><fo:external-graphic content-height="scale-to-fit" height="1in"><xsl:attribute name="src">url('<xsl:value-of select="./@url" />')</xsl:attribute></fo:external-graphic></fo:block>                                 <fo:block text-align="center" margin-right="1in" margin-left="1in"><xsl:value-of select="." /></fo:block>                             </xsl:when>                             <xsl:otherwise/>                         </xsl:choose>                     </xsl:for-each>                     <fo:block margin-right="1in" margin-left="1in" margin-top="0.1in"><xsl:value-of select="review/content/p[last()]/following::text()[1]" /></fo:block>                 </fo:flow>             </fo:page-sequence>         </xsl:for-each>     </fo:root> </xsl:template> 

that code display pros, cons , review content of xml file. displays information , pictures correctly , inserts page break after cons must. problem comes in review content 1 page , displays on after- , before-regions.

what get:           want:  ______________       ______________ |              |     |              | |  pros        |     |  pros        | |    blabla    |     |    blabla    | |              |     |              | |  cons        |     |  cons        | |    blabla    |     |    blabla    | |              |     |              | |              |     |              | |______________|     |______________|  ______________       ______________ |              |     |              | |  content     |     |  content     | |              |     |              | |  ~~~~~~~~~~  |     |  ~~~~~~~~~~  | |  ~~~~~~~~~~  |     |  ~~~~~~~~~~  | |  ~~~~~~~~~~  |     |  ~~~~~~~~~~  | |  ~~~~~~~~~~  |     |  ~~~~~~~~~~  | |  ~~~~~~~~~~  |     |  ~~~~~~~~~~  | |__~~~~~~~~~~__|     |______________|  ______________       ______________ |  ~~~~~~~~~~  |     |              | |  ~~~~~~~~~~  |     |  ~~~~~~~~~~  | |  ~~~~~~~~~~  |     |  ~~~~~~~~~~  | |  ~~~~~~~~~~  |     |  ~~~~~~~~~~  | |              |     |  ~~~~~~~~~~  | |              |     |  ~~~~~~~~~~  | |              |     |              | |              |     |              | |______________|     |______________| 

here regions , names:

 ______________ |    before    | |______________| | s|        |  | | t|        |e | | a|  body  |n | | r|        |d | | t|        |  | |__|________|__| |    after     | |______________| 

(p.s. body stretches page border , not other regions)

it seems missed 2 things here:

first, width , height of page, change <fo:simple-page-master master-name="forsalepage"> <fo:simple-page-master master-name="forsalepage" page-height="11in" page-width="8.5in">

second, change <fo:region-body/> <fo:region-body margin="1in"/>


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -