T
TadPole
Hi all,
My main problems are:::::::::
1. Set a value within a block container that can be used and changed by
subsequent templates/block-containers/tables etc..
2. get/determine/find the setting that tell the process that the new
top of the document region is now at the end of the last
block-container used, this must be set in that last block container.
3. find the value used in the 'top" setting on the prior
position="absolute" in the block container.
What I am trying to do is::::::
We have an existing system that has some reports; these reports need to
be reproduced verbatim in a PDF format using XML&XSL --> FOP --> PDF.
The reports aren't to complex and we have devised a way in which the
existing programs can write out a useful XML file that has the
structure as per the previous report, see XML further down.
The text and structure of the report will be kept using an XSL style
sheet.
I have automated the XSL creation as there a many reports that are
required so it doesn't make sense to sit down and manually code these
to style sheets, I wrote a program that looked at the structure of
existing reports and wrote the appropriate XSL syntax for it (but I
need a workable template!!, so this is what is sending me a bit,loopy)
I have been able to get the XML elements to line up correctly, but the
main problem is that some of the elements need to be placed in an exact
position (lines down) on the page, and then the rest of the elements
need to be placed after that absolute positioned block. This means I
don't care about the positioning of any XML tags that follow the TAG
that was absolutely positioned via the block-container, but, the
following XML tags (and content etc.) should start after the block
container that was absolutely positioned (confused, well, whose on
first).
What I have done so far:::::::CPI & LPI conversion
Match the report LPI and CPI --> easy enough done by using courier new
and setting line-height and height as an attribute of the
block-container or the table that is being used. Some report lines need
to absolutely positioned --> Can be done via the shorthand
block-container position="absolute", in fact works greater. Please see
following:
<fo:block-container xsl:use-attribute-sets="block-container"
top="1*{$doc-line}in">
<xsl:attribute-set name="block-container">
<xsl:attribute name="position">absolute</xsl:attribute>
<xsl:attribute name="width">100%</xsl:attribute>
<xsl:attribute name="height">0.1in</xsl:attribute>
<xsl:attribute name="line-height">0.1in</xsl:attribute>
</xsl:attribute-set>
<fo:table xsl:use-attribute-sets="table">
<xsl:attribute-set name="table">
<xsl:attribute name="table-layout">fixed</xsl:attribute>
<xsl:attribute
name="inline-progression-dimension.maximum">100%</xsl:attribute>
<xsl:attribute name="height">0.1in</xsl:attribute>
<xsl:attribute name="line-height">0.1in</xsl:attribute>
</xsl:attribute-set>
I am using the xsl:use-attribute-sets as the attribute set resides in
another XSL, it made sense to me that. If I wish to change this for any
reason I could change it one place, and it would update all the style
sheets that use it.
Please also note that in the block-container I have used the
top="1*{$doc-line}in". The 1 is a static value for each
block-container, the program I have written to create the XSL places it
there and, the $doc-line is a global variable that has been set to 0.1,
so the calculation top=1*0.1 in or top = 0.1in, this means that the
absolute positioning of this 0.1in from the top, as the lines on the
previous reports were 10 lines per inch it matches perfectly.
What I have done so far::::::: detail line conversion.
The detail line is broken up into table-columns, each detail line can
be different to the last, but I need to keep the details of the lineup
of the line to be the same so it will match the previous report, the
way I did this was to use the following, please note the prior report
was 132 chars across, so this report should be the same, also that the
proportional-column-width() will add up to 100% even though the total
is 132, that is that it will add up all then proportion them to the
100% used.
<xsl:template match="DTL01">
<fo:table xsl:use-attribute-sets="table">
<fo:table-column column-width="proportional-column-width(7)"/>
<fo:table-column column-width="proportional-column-width(3)"/>
<fo:table-column column-width="proportional-column-width(40)"/>
<fo:table-column column-width="proportional-column-width(3)"/>
<fo:table-column column-width="proportional-column-width(30)"/>
<fo:table-column column-width="proportional-column-width(49)"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell text-align="right">
<fo:block>
<xsl:call-template name="formatZeroDecimals">
<xsl:with-param name="number" select="CLTKYC"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell/>
<fo:table-cell>
<fo:block>
<xsl:value-of select="CLNAMC"/>
</fo:block>
</fo:table-cell>
<fo:table-cell/>
<fo:table-cell>
<fo:block>
<xsl:value-of select="ADDR1C"/>
</fo:block>
</fo:table-cell>
<fo:table-cell/>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
This is the second main detail line:::::: (again 132)
<xsl:template match="DTL02">
<fo:table xsl:use-attribute-sets="table"/> <!-- space line -->
<fo:table xsl:use-attribute-sets="table">
<fo:table-column column-width="proportional-column-width(53)"/>
<!-- spaces -->
<fo:table-column column-width="proportional-column-width(2)"/>
<!-- text -->
<fo:table-column column-width="proportional-column-width(2)"/>
<!-- spaces -->
<fo:table-column column-width="proportional-column-width(16)"/>
<!-- phone -->
<fo:table-column column-width="proportional-column-width(59)"/>
<!-- spaces -->
<fo:table-body>
<fo:table-row>
<fo:table-cell/>
<fo:table-cell>
<fo:block>P:</fo:block>
</fo:table-cell>
<fo:table-cell/>
<fo:table-cell>
<fo:block>
<xsl:value-of select="PHONEC"/>
</fo:block>
</fo:table-cell>
<fo:table-cell/>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
What I cannot yet do:::::::::::::::::::::::::::::::::::!!!???##@@!!
The detail lines i.e. DTL01 & DTL02 must follow an absolutely position
line that is set in about the middle of the page, in some case 3/3 or
1/4 down the page, it varies in some reports.
I have tried creating a variable that is set within the block
container, but it cannot be passed to subsequent templates and the
value is only set within the template that is being processed. In some
cases the absolute positioned tag may not be placed on the report.
There is no counter I can increment for line number or any other number
number I wish to make up. Some things can be counted, like node()
position(), but these are no good to me as I wish to count lines, in
some cases I wish to write a space between the lines (see DTL02).
Variable are static in XSL, and cannot be incremented, that suck, I
mean that really suck, it is like meatloaf through a straw it sucks and
it sucks hard.
What I would like to do is one of the following:::::::::
1. Set a value within a block container that can be used and changed by
subsequent templates.
2. get the setting that tell the process that the new top of the
document region is now at the end of the last block-container used,
this must be set in that last block container.
Please see full XML:::::::::::::::::::::::::::
Please note in this case it is the HEADER and the CHEQUE_AMOUNT are the
ones that need to be absolutely positioned, and the DTL01 and DTL02
need to come after the CHEQUE_AMOUNT
<?xml version="1.0" encoding="UTF-8"?>
<REPORT>
<DATE>23092005</DATE>
<TIME>10403700</TIME>
<LAYOUT></LAYOUT>
<DESIGN></DESIGN>
<CL999>
<HEADER>
<CMPNY_>Company NameXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CMPNY_>
</HEADER>
<TOT01>
<CHEQUE_AMOUNT>123456</CHEQUE_AMOUNT>
</TOT01>
<DTL01>
<CLTKYC>0000001</CLTKYC>
<CLNAMC>Client NameXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CLNAMC>
<ADDR1C>Address line 1XXXXXXXXXXXXXXXX</ADDR1C>
<UNDCDC>UCD</UNDCDC>
<_UNDCD>Underwriter codeXXXXXXXXXXXXXX</_UNDCD>
</DTL01>
<DTL02>
<PHONEC>+03 9576 4533XXX</PHONEC>
</DTL02>
<DTL01>
<CLTKYC>0000002</CLTKYC>
<CLNAMC>Client NameXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CLNAMC>
<ADDR1C>Address line 1XXXXXXXXXXXXXXXX</ADDR1C>
<UNDCDC>UCD</UNDCDC>
<_UNDCD>Underwriter codeXXXXXXXXXXXXXX</_UNDCD>
</DTL01>
<DTL02>
<PHONEC>+03 9576 4533XXX</PHONEC>
</DTL02>
<DTL01>
<CLTKYC>0000003</CLTKYC>
<CLNAMC>Client NameXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CLNAMC>
<ADDR1C>Address line 1XXXXXXXXXXXXXXXX</ADDR1C>
<UNDCDC>UCD</UNDCDC>
<_UNDCD>Underwriter codeXXXXXXXXXXXXXX</_UNDCD>
</DTL01>
<DTL02>
<INDEXC>IndexXXXXXXXXXXX</INDEXC>
<ADDR2C>Address line 2XXXXXXXXXXXXXXXX</ADDR2C>
<SERCLC>X</SERCLC>
<_SERCL>Service classXXXXXXXXXXXXXXXXX</_SERCL>
</DTL02>
</CL999>
</REPORT>
My main problems are:::::::::
1. Set a value within a block container that can be used and changed by
subsequent templates/block-containers/tables etc..
2. get/determine/find the setting that tell the process that the new
top of the document region is now at the end of the last
block-container used, this must be set in that last block container.
3. find the value used in the 'top" setting on the prior
position="absolute" in the block container.
What I am trying to do is::::::
We have an existing system that has some reports; these reports need to
be reproduced verbatim in a PDF format using XML&XSL --> FOP --> PDF.
The reports aren't to complex and we have devised a way in which the
existing programs can write out a useful XML file that has the
structure as per the previous report, see XML further down.
The text and structure of the report will be kept using an XSL style
sheet.
I have automated the XSL creation as there a many reports that are
required so it doesn't make sense to sit down and manually code these
to style sheets, I wrote a program that looked at the structure of
existing reports and wrote the appropriate XSL syntax for it (but I
need a workable template!!, so this is what is sending me a bit,loopy)
I have been able to get the XML elements to line up correctly, but the
main problem is that some of the elements need to be placed in an exact
position (lines down) on the page, and then the rest of the elements
need to be placed after that absolute positioned block. This means I
don't care about the positioning of any XML tags that follow the TAG
that was absolutely positioned via the block-container, but, the
following XML tags (and content etc.) should start after the block
container that was absolutely positioned (confused, well, whose on
first).
What I have done so far:::::::CPI & LPI conversion
Match the report LPI and CPI --> easy enough done by using courier new
and setting line-height and height as an attribute of the
block-container or the table that is being used. Some report lines need
to absolutely positioned --> Can be done via the shorthand
block-container position="absolute", in fact works greater. Please see
following:
<fo:block-container xsl:use-attribute-sets="block-container"
top="1*{$doc-line}in">
<xsl:attribute-set name="block-container">
<xsl:attribute name="position">absolute</xsl:attribute>
<xsl:attribute name="width">100%</xsl:attribute>
<xsl:attribute name="height">0.1in</xsl:attribute>
<xsl:attribute name="line-height">0.1in</xsl:attribute>
</xsl:attribute-set>
<fo:table xsl:use-attribute-sets="table">
<xsl:attribute-set name="table">
<xsl:attribute name="table-layout">fixed</xsl:attribute>
<xsl:attribute
name="inline-progression-dimension.maximum">100%</xsl:attribute>
<xsl:attribute name="height">0.1in</xsl:attribute>
<xsl:attribute name="line-height">0.1in</xsl:attribute>
</xsl:attribute-set>
I am using the xsl:use-attribute-sets as the attribute set resides in
another XSL, it made sense to me that. If I wish to change this for any
reason I could change it one place, and it would update all the style
sheets that use it.
Please also note that in the block-container I have used the
top="1*{$doc-line}in". The 1 is a static value for each
block-container, the program I have written to create the XSL places it
there and, the $doc-line is a global variable that has been set to 0.1,
so the calculation top=1*0.1 in or top = 0.1in, this means that the
absolute positioning of this 0.1in from the top, as the lines on the
previous reports were 10 lines per inch it matches perfectly.
What I have done so far::::::: detail line conversion.
The detail line is broken up into table-columns, each detail line can
be different to the last, but I need to keep the details of the lineup
of the line to be the same so it will match the previous report, the
way I did this was to use the following, please note the prior report
was 132 chars across, so this report should be the same, also that the
proportional-column-width() will add up to 100% even though the total
is 132, that is that it will add up all then proportion them to the
100% used.
<xsl:template match="DTL01">
<fo:table xsl:use-attribute-sets="table">
<fo:table-column column-width="proportional-column-width(7)"/>
<fo:table-column column-width="proportional-column-width(3)"/>
<fo:table-column column-width="proportional-column-width(40)"/>
<fo:table-column column-width="proportional-column-width(3)"/>
<fo:table-column column-width="proportional-column-width(30)"/>
<fo:table-column column-width="proportional-column-width(49)"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell text-align="right">
<fo:block>
<xsl:call-template name="formatZeroDecimals">
<xsl:with-param name="number" select="CLTKYC"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell/>
<fo:table-cell>
<fo:block>
<xsl:value-of select="CLNAMC"/>
</fo:block>
</fo:table-cell>
<fo:table-cell/>
<fo:table-cell>
<fo:block>
<xsl:value-of select="ADDR1C"/>
</fo:block>
</fo:table-cell>
<fo:table-cell/>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
This is the second main detail line:::::: (again 132)
<xsl:template match="DTL02">
<fo:table xsl:use-attribute-sets="table"/> <!-- space line -->
<fo:table xsl:use-attribute-sets="table">
<fo:table-column column-width="proportional-column-width(53)"/>
<!-- spaces -->
<fo:table-column column-width="proportional-column-width(2)"/>
<!-- text -->
<fo:table-column column-width="proportional-column-width(2)"/>
<!-- spaces -->
<fo:table-column column-width="proportional-column-width(16)"/>
<!-- phone -->
<fo:table-column column-width="proportional-column-width(59)"/>
<!-- spaces -->
<fo:table-body>
<fo:table-row>
<fo:table-cell/>
<fo:table-cell>
<fo:block>P:</fo:block>
</fo:table-cell>
<fo:table-cell/>
<fo:table-cell>
<fo:block>
<xsl:value-of select="PHONEC"/>
</fo:block>
</fo:table-cell>
<fo:table-cell/>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
What I cannot yet do:::::::::::::::::::::::::::::::::::!!!???##@@!!
The detail lines i.e. DTL01 & DTL02 must follow an absolutely position
line that is set in about the middle of the page, in some case 3/3 or
1/4 down the page, it varies in some reports.
I have tried creating a variable that is set within the block
container, but it cannot be passed to subsequent templates and the
value is only set within the template that is being processed. In some
cases the absolute positioned tag may not be placed on the report.
There is no counter I can increment for line number or any other number
number I wish to make up. Some things can be counted, like node()
position(), but these are no good to me as I wish to count lines, in
some cases I wish to write a space between the lines (see DTL02).
Variable are static in XSL, and cannot be incremented, that suck, I
mean that really suck, it is like meatloaf through a straw it sucks and
it sucks hard.
What I would like to do is one of the following:::::::::
1. Set a value within a block container that can be used and changed by
subsequent templates.
2. get the setting that tell the process that the new top of the
document region is now at the end of the last block-container used,
this must be set in that last block container.
Please see full XML:::::::::::::::::::::::::::
Please note in this case it is the HEADER and the CHEQUE_AMOUNT are the
ones that need to be absolutely positioned, and the DTL01 and DTL02
need to come after the CHEQUE_AMOUNT
<?xml version="1.0" encoding="UTF-8"?>
<REPORT>
<DATE>23092005</DATE>
<TIME>10403700</TIME>
<LAYOUT></LAYOUT>
<DESIGN></DESIGN>
<CL999>
<HEADER>
<CMPNY_>Company NameXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CMPNY_>
</HEADER>
<TOT01>
<CHEQUE_AMOUNT>123456</CHEQUE_AMOUNT>
</TOT01>
<DTL01>
<CLTKYC>0000001</CLTKYC>
<CLNAMC>Client NameXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CLNAMC>
<ADDR1C>Address line 1XXXXXXXXXXXXXXXX</ADDR1C>
<UNDCDC>UCD</UNDCDC>
<_UNDCD>Underwriter codeXXXXXXXXXXXXXX</_UNDCD>
</DTL01>
<DTL02>
<PHONEC>+03 9576 4533XXX</PHONEC>
</DTL02>
<DTL01>
<CLTKYC>0000002</CLTKYC>
<CLNAMC>Client NameXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CLNAMC>
<ADDR1C>Address line 1XXXXXXXXXXXXXXXX</ADDR1C>
<UNDCDC>UCD</UNDCDC>
<_UNDCD>Underwriter codeXXXXXXXXXXXXXX</_UNDCD>
</DTL01>
<DTL02>
<PHONEC>+03 9576 4533XXX</PHONEC>
</DTL02>
<DTL01>
<CLTKYC>0000003</CLTKYC>
<CLNAMC>Client NameXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CLNAMC>
<ADDR1C>Address line 1XXXXXXXXXXXXXXXX</ADDR1C>
<UNDCDC>UCD</UNDCDC>
<_UNDCD>Underwriter codeXXXXXXXXXXXXXX</_UNDCD>
</DTL01>
<DTL02>
<INDEXC>IndexXXXXXXXXXXX</INDEXC>
<ADDR2C>Address line 2XXXXXXXXXXXXXXXX</ADDR2C>
<SERCLC>X</SERCLC>
<_SERCL>Service classXXXXXXXXXXXXXXXXX</_SERCL>
</DTL02>
</CL999>
</REPORT>