xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drevivo <drev...@hotmail.com>
Subject RE: Implementing Change bars
Date Thu, 20 Jun 2013 10:37:34 GMT

here is a simplified fully functioning xml and xsl.
ThanksDavid

xml
<data>
   <p rev="1">text with revbar</p>
   <note>
      <p>text in a note No revbar</p>
      <p rev="1">text in a note with revbar</p>
   </note>
</data>

xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:r="http://nwalsh.com/xmlns/extreme2006/recipes/" 
                xmlns="http://www.w3.org/1999/xhtml" 
                xmlns:fn="http://www.w3.org/2005/xpath-functions"               
                xmlns:fo="http://www.w3.org/1999/XSL/Format"                
                version="1.0">

<xsl:template match="data">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
  <fo:simple-page-master master-name="A4">
    <xsl:attribute name="margin">10mm 13.5mm 10mm 25mm</xsl:attribute>
    <xsl:attribute name="page-width">215.9mm</xsl:attribute>
    <xsl:attribute name="page-height">279.4mm</xsl:attribute>
    <xsl:attribute name="font-family">Helvetica</xsl:attribute>
    <fo:region-body region-name="xsl-region-body">
        <xsl:attribute name="margin">21mm 0mm 9.5mm 0mm</xsl:attribute>
    </fo:region-body>
    
  </fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="A4">
  <fo:flow flow-name="xsl-region-body">
    
    <xsl:apply-templates />    
  </fo:flow>
</fo:page-sequence>

</fo:root>
</xsl:template>



<xsl:template match="p">
    <fo:block>
        <xsl:call-template name="rev.bar" />
        
        <xsl:attribute name="margin-top">5px</xsl:attribute>
        <xsl:attribute name="margin-bottom">5px</xsl:attribute> 
        
        <xsl:apply-templates />     
    </fo:block>
</xsl:template>

<xsl:template match="note">
    
    <fo:block>
        <xsl:attribute name="text-align">center</xsl:attribute>
        <xsl:attribute name="font-size">10pt</xsl:attribute>       
        <xsl:attribute name="font-weight">bold</xsl:attribute>
        <xsl:attribute name="margin">2mm 37mm 0mm 37mm</xsl:attribute>
        
        <xsl:apply-templates /> 
        
    </fo:block>
    
</xsl:template>

<xsl:template name="rev.bar">
    <xsl:if test="@rev='1'">
        <xsl:attribute name="border-start-color">black</xsl:attribute>
        <xsl:attribute name="border-start-style">solid</xsl:attribute>
        <xsl:attribute name="padding-start">13pt</xsl:attribute>
        <xsl:attribute name="border-start-width">2pt</xsl:attribute>
     </xsl:if>
</xsl:template>
</xsl:stylesheet>
 		 	   		  

RevBarSample.zip (12K) <http://apache-fop.1065347.n5.nabble.com/attachment/38756/0/RevBarSample.zip>




--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Implementing-Change-bars-tp16058p38756.html
Sent from the FOP - Users mailing list archive at Nabble.com.
Mime
View raw message