I have a word document (.doc) that I have converted to an XSL-FO so that I can add a user's input, but the conversion wasn't the greatest so I am modifying the FO to match the original word document. The word document has line numbers going down the left side of each page. See screenshot of original .doc file. I found this article to be somewhat useful thanks to Dimitre Novatchev's answer, but I get a Stack Overflow exception with his solution. Mr. AH had a great solution, but I don't like the idea of manually adding the line number to every line on each page. Each page has 28 lines.
Is there something I can do that is similar to a header or footer?
Or would it make sense to create the line numbers with an image and insert the image on each page?
I'm using Apache's FOP 1.0 library with Java driving in the background. (upgrading to 2.0 is not an option)
My .fo file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xml:space="preserve">
<xsl:strip-space elements="fo:inline"/>
<fo:root xmlns:myHelper="com.my.path.XslHelper"
xmlns:svg="http://www\.w3\.org/2000/svg"
xmlns:exsl="http://xmlns.opentechnology.org/xslt-extensions/common"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags" >
<fo:layout-master-set xmlns:rx="http://www.renderx.com/XSL/Extensions"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<fo:simple-page-master master-name="simple" page-width="8.5in" page-height="11in" margin-top=".5in" margin-bottom=".3in" margin-left=".75in" margin-right=".7in">
<fo:region-body region-name="xsl-region-body" margin-top=".50in" margin-bottom=".5in"/>
<fo:region-before region-name="xsl-region-before" extent="5in"/>
<fo:region-after region-name="xsl-region-after" extent=".5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence xmlns:rx="http://www.renderx.com/XSL/Extensions"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
master-reference="simple"
id="IDDEWVO12VGWFHFXTK2ROJBGP3HLXLWHRYZMPQZ5NGVSECKDMKHTTH"
format="1">
<fo:static-content flow-name="xsl-region-before">
<fo:block></fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center"><fo:page-number/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" font-family="TimesNewRoman" font-size="12pt" line-height="1.7205" language="EN-US">
<fo:block widows="2" orphans="2" white-space-collapse="false" break-after="page">
<xsl:variable name="confidentialChecked"><xsl:choose><xsl:when test="$livingTogether = 'Yes'">[x]</xsl:when><xsl:otherwise>[ ]</xsl:otherwise></xsl:choose></xsl:variable>
<fo:inline>2.<xsl:value-of select="$spacer"/>My address is: <xsl:value-of select="$confidentialChecked"/> </fo:inline><fo:inline font-weight="bold" text-decoration="underline">CONFIDENTIAL</fo:inline><fo:inline> (If confidential, do not write address here)</fo:inline>
</fo:block>
<fo:block start-indent="36pt">
<fo:inline>Address: <xsl:value-of select="concat($pl1_addressLine1, ' ', $pl1_addressLine2)"/></fo:inline>
</fo:block>
<fo:block start-indent="36pt">
<fo:inline>City: <xsl:value-of select="$pl1_city"/> State: <xsl:value-of select="$pl1_state"/> Zip: <xsl:value-of select="$pl1_postalCode"/></fo:inline>
</fo:block>
<fo:block start-indent="36pt">
<xsl:variable name="ownRent"><xsl:choose><xsl:when test="$pl1_ownOrRent = 'Own'">[x] own [ ] rent</xsl:when><xsl:when test="$pl1_ownOrRent = 'Rent'">[ ] own [x] rent</xsl:when><xsl:otherwise>[ ] own [ ] rent</xsl:otherwise></xsl:choose></xsl:variable>
<fo:inline>I <xsl:value-of select="$ownRent"/> this residence. Lease/title is held in all the following name(s):</fo:inline>
</fo:block>
<fo:block text-indent="36pt">
<fo:inline><xsl:value-of select="$pl1_residenceLeaseNames"/></fo:inline>
</fo:block>
<fo:block start-indent="36pt">
<fo:inline>How long have you been living in this residence? <xsl:value-of select="$pl1_timeAtResidence"/></fo:inline>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
I'm new to all of this FO stuff, so please let me know what other info you need to help me with this. Thanks in advance!