XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + First time to Stylus Studio 20... (3)
-> + xsl:if test statement result t... (4)
-> + XSLT for dynamic target fields (4)
-> + Remove duplicates (2)
-> + XML-XSL grouping issue while d... (2)
-> + Two XML files. Two Tables. One... (3)
-> + Saxon 9.3 with XSLV (2)
-> - How do I remove the text strin... (1)
-> + Xpath of each element (3)
-> + Attributes - required vs optio... (2)
-> + XML schema to XML schema with ... (2)
-> + how to preserve the & in X... (2)
-> + how to use variables within (2)
-> + need help in XSLT programming (3)
-> + XSLT Mapper Option... Where i... (3)
-> - Selecting element based on att... (1)
-> + replace question (2)
-> - select other node based on one... (1)
-> - XSLT question... (1)
-> - Mapper and XSL (1)
-> - Copying XML as is with one cha... (1)
-> - Help with XSLT (1)
-> - XSL repeat the parent node for... (1)
-> - xls to xml (1)
-> - Stylus support non-backreferen... (1)
-> - Assigning records to existing ... (1)
-> + xsl:for-each and key() (2)
-> + tags containing a: (2)
-> - Create a namespace in output f... (1)
-> - XML Converters problem on UNIX (1)
-> - Copy XML Based on IF Condition... (1)
-> - csv counting dependencies (1)
-> + For extension function, could ... (2)
-> - XML XSLT Transformation (1)
-> + Transform XSD to another XSD (3)
-> - New to Stylus (1)
-> + my enterprise install doesn't ... (2)
-> - Replace line in XML (1)
-> - 5010 HIPAA - Example EDI files... (1)
-> - Display table in two columns f... (1)
-> + java.lang.RuntimeException (4)
-> + Select Value-Of Qualified Elem... (2)
-> + Validating different sets of r... (2)
-> + Passing complete source docume... (2)
-> - XSLT to sort XML per schema (1)
-> - XSL to select the group of row... (1)
-> + first ancestor of a type (2)
-> - Column Width Adjustment (1)
-> + XSLT breakpoint being ignored ... (6)
-> - Creating a tab delimited file (1)
-> - Invalid characters in xml (1)
-> + Creating XSLT File Based on XS... (2)
-> - Unable to filter InputStream f... (1)
-> + finding a list of values (7)
-> - TEMP directory question (1)
-> - [HELP] Template and namespace (1)
-> - The prefix "xsl" for element "... (1)
-> - Need help comparing dates in x... (1)
-> - trying to sort a list of artic... (1)
-> + Count unique values using XSLT (3)
-> + Dot "." vs. self::node() (2)
-> + Output from report and XSL do ... (2)
-> + XSL report (2)
-> + cannot see valid values in the... (2)
-> - sum function help (1)
-> + XSLT transformation problem (2)
-> + Flat To nested XML using Keys (3)
-> - XSLT Editor autocomplete funct... (1)
-> - Receiving an argument from a l... (1)
-> + Can't using the Xalan-J in Sty... (2)
-> + Need help testing to see if th... (2)
-> + Any good way to handle repeati... (2)
-> - Renaming child element name wh... (1)
-> + What to do to only how last 4 ... (2)
-> + Help to access an element with... (3)
-> - Multiplication for-each (1)
-> - XSL / X-Path query (1)
-> - Help in creating XSD (1)
-> + JAVASCRIPT Inside XSL (2)
-> + is at possible to create edita... (2)
-> + Grouping on Multiple Field (2)
-> + XSLT 1.0 Grouping Small change... (2)
-> + Revision bar based on the page... (2)
-> + xslt to rtf (2)
-> + XEP/FOP Error (3)
-> + XML to XML Transformation (3)
-> + This XSLT has stumped me.. (2)
-> + converting XML to EACOM format (2)
-> + Stylus with XSLT 1.0 + EXSLT T... (2)
-> + Xslt Mapper (2)
-> - xml to xsl (1)
-> - creating a website (1)
-> - XML to PDF using XML Publisher... (1)
-> - Replace nodes (1)
-> - New to XSLT, need help with a ... (1)
-> - Modify XSLT - Have List of Cha... (1)
-> - Replace nodes in one xml file ... (1)
-> - Alternate Row Colour (1)
-> - convert text to XML and then m... (1)
-> - CDATA to XML - work with trans... (1)
-- Previous [61-80] [81-100] [101-120] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Posttop
Shayne ZabaSubject: Display table in two columns from one continuous data field
Author: Shayne Zaba
Date: 30 Nov 2010 08:16 PM
Hey Guys,

I realize this post has come up before, but i'm dealing with prepackaged code and the examples i've seen posted so far are no help in dealing with the code i've got.

Please review the quoted code and let me know what I need to change to get my data in two columns, top to bottom and left to right.

I appreciate the help as this code is well beyond my understanding.

i'm trying to display my inventory data from SQL in PDF using this transform.

I believe the code i need to alter is in this section quoted directly below, but i've also included the entire xsl doc for clearification:

<!-- Main table -->
<xsl:template match="MainTable/table">
<xsl:if test="//Options/@FopOutputFormat = 'rtf'">
<!-- Workaround to handle PageBreak/Line Feed for RTF: write an invisible character -->
<fo:block color="white">_</fo:block>
</xsl:if>

<fo:table border-style="solid" table-layout="fixed" space-before.optimum="6pt" inline-progression-dimension.maximum="100%">
<xsl:attribute name="border-width">
<xsl:value-of select="$CellBorderWidth"/>
</xsl:attribute>
<xsl:attribute name="border-color">
<xsl:value-of select="$CellBorderColor"/>
</xsl:attribute>
<!-- Column width: limit the number of columns, the trick is to count the columns of the last line where we do not have col span -->
<xsl:variable name="colNumber" select="count(tr[@rownumber=count(../tr)]/td)"/>
<xsl:for-each select="//MainTable/Column[@Id&lt;=$colNumber]">
<fo:table-column>
<xsl:if test="@Width != ''">
<xsl:attribute name="column-width">
<xsl:value-of select="@Width"/>
</xsl:attribute>
</xsl:if>
</fo:table-column>
</xsl:for-each>

<xsl:choose>
<xsl:when test="//Options/@MainTableHeaderRows > 0">
<fo:table-header>
<xsl:apply-templates select="tr[@rownumber&lt;=//Options/@MainTableHeaderRows]"/>
</fo:table-header>

<fo:table-body>
<xsl:apply-templates select="tr[@rownumber>//Options/@MainTableHeaderRows]"/>
<xsl:if test="count(tr[@rownumber>//Options/@MainTableHeaderRows]) = 0">
<!-- Add dummy row if necessary -->
<fo:table-row><fo:table-cell><fo:block/></fo:table-cell></fo:table-row>
</xsl:if>
</fo:table-body>
</xsl:when>
<xsl:otherwise>
<fo:table-body>
<xsl:apply-templates select="tr"/>
</fo:table-body>
</xsl:otherwise>
</xsl:choose>
</fo:table>
</xsl:template>


Entire Doc below:

<?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:variable name="CellFontStyleRowTitle" select="//CellFontStyle/@RowTitle"/>
<xsl:variable name="CellFontWeightRowTitle" select="//CellFontWeight/@RowTitle"/>
<xsl:variable name="CellFontColorRowTitle" select="//CellFontColor/@RowTitle"/>
<xsl:variable name="CellFontStyleRowValue" select="//CellFontStyle/@RowValue"/>
<xsl:variable name="CellFontWeightRowValue" select="//CellFontWeight/@RowValue"/>
<xsl:variable name="CellFontColorRowValue" select="//CellFontColor/@RowValue"/>
<xsl:variable name="CellFontStyleColTitle" select="//CellFontStyle/@ColTitle"/>
<xsl:variable name="CellFontWeightColTitle" select="//CellFontWeight/@ColTitle"/>
<xsl:variable name="CellFontColorColTitle" select="//CellFontColor/@ColTitle"/>
<xsl:variable name="CellFontStyleColValue" select="//CellFontStyle/@ColValue"/>
<xsl:variable name="CellFontWeightColValue" select="//CellFontWeight/@ColValue"/>
<xsl:variable name="CellFontColorColValue" select="//CellFontColor/@ColValue"/>
<xsl:variable name="CellFontStyleDataTitle" select="//CellFontStyle/@DataTitle"/>
<xsl:variable name="CellFontWeightDataTitle" select="//CellFontWeight/@DataTitle"/>
<xsl:variable name="CellFontColorDataTitle" select="//CellFontColor/@DataTitle"/>
<xsl:variable name="CellFontStyleDataValue" select="//CellFontStyle/@DataValue"/>
<xsl:variable name="CellFontWeightDataValue" select="//CellFontWeight/@DataValue"/>
<xsl:variable name="CellFontColorDataValue" select="//CellFontColor/@DataValue"/>
<xsl:variable name="CellFontStyleAggValue" select="//CellFontStyle/@AggValue"/>
<xsl:variable name="CellFontWeightAggValue" select="//CellFontWeight/@AggValue"/>
<xsl:variable name="CellFontColorAggValue" select="//CellFontColor/@AggValue"/>
<xsl:variable name="CellFontStyleSubTotalValue" select="//CellFontStyle/@SubTotalValue"/>
<xsl:variable name="CellFontWeightSubTotalValue" select="//CellFontWeight/@SubTotalValue"/>
<xsl:variable name="CellFontColorSubTotalValue" select="//CellFontColor/@SubTotalValue"/>

<xsl:variable name="CellBorderWidth" select="//Main/@CellBorderWidth"/>
<xsl:variable name="CellBorderColor" select="//Main/@CellBorderColor"/>

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

<fo:layout-master-set>
<fo:simple-page-master master-name="A4-portrait"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="1cm"
margin-left="1.5cm"
margin-right="1.5cm">
<fo:region-body margin-top="3cm" margin-bottom="1.5cm"/>
<fo:region-before extent="3cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>

<fo:simple-page-master master-name="A4-landscape"
page-height="21cm"
page-width="29.7cm"
margin-top="1cm"
margin-bottom="1cm"
margin-left="1.5cm"
margin-right="1.5cm">
<fo:region-body margin-top="3cm" margin-bottom="1.5cm"/>
<fo:region-before extent="3cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>

</fo:layout-master-set>

<fo:page-sequence master-reference="A4-portrait">
<xsl:if test="PrintingInLandscape = 'true' or //Options/@PageOrientation = 'landscape'">
<xsl:attribute name="master-reference">A4-landscape</xsl:attribute>
</xsl:if>

<!-- Page header: title image and log -->
<fo:static-content flow-name="xsl-region-before">
<xsl:if test="//Images/@Title != ''">
<fo:block space-after.optimum="1pt" text-align="right">
<xsl:attribute name="text-align">
<xsl:value-of select="//Images/@TitleAlign"/>
</xsl:attribute>
<fo:external-graphic>
<xsl:attribute name="src">
<xsl:value-of select="//Images/@Title"/>
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</xsl:if>

<fo:block space-after.optimum="2pt" linefeed-treatment="preserve" white-space-treatment="preserve" white-space-collapse="false">
<xsl:attribute name="text-align">
<xsl:value-of select="//Title/@Align"/>
</xsl:attribute>
<xsl:attribute name="font-family">
<xsl:value-of select="//Title/@FontFamily"/>
</xsl:attribute>
<xsl:attribute name="font-size">
<xsl:value-of select="//Title/@FontSize"/>
</xsl:attribute>
<xsl:attribute name="font-weight">
<xsl:value-of select="//Title/@FontWeight"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//Title/@FontColor"/>
</xsl:attribute>
<xsl:value-of select="//ReportTitle"/>
</fo:block>
</fo:static-content>

<!-- Page footer: page number -->
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center" space-before.optimum="6pt" line-height="1em + 2pt">
<xsl:if test="//Visibility/@ShowPageNumber = 'visible'">
<xsl:attribute name="font-family">
<xsl:value-of select="//Main/@FontFamily"/>
</xsl:attribute>
<xsl:attribute name="font-size">
<xsl:value-of select="//Main/@FontSize"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//Main/@FontColor"/>
</xsl:attribute>
<!-- fo:page-number-citation is not supported for rtf -->
<xsl:choose>
<xsl:when test="//Options/@FopOutputFormat = 'rtf'">
- <fo:page-number/> -
</xsl:when>
<xsl:otherwise>
- <fo:page-number/> / <fo:page-number-citation ref-id="endofdoc"/> -
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</fo:block>
</fo:static-content>

<!-- Page body -->
<fo:flow flow-name="xsl-region-body">
<fo:block id="Top" linefeed-treatment="preserve" white-space-treatment="preserve" white-space-collapse="false">
<xsl:attribute name="font-family">
<xsl:value-of select="//Main/@FontFamily"/>
</xsl:attribute>
<xsl:attribute name="font-size">
<xsl:value-of select="//Main/@FontSize"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//Main/@FontColor"/>
</xsl:attribute>

<!-- Restrictions and descriptions table: 2 columns-->
<xsl:if test="ReportRestrictions != '' or SecurityRestrictions != '' or ReportDescription != ''">
<fo:table space-after.optimum="16pt" table-layout="fixed" width="100%">
<fo:table-column column-width="40mm"/>
<fo:table-column>
<xsl:if test="//Options/@FopOutputFormat = 'rtf' and //Options/@PageOrientation = 'portrait'">
<!-- For RTF, force the size -->
<xsl:attribute name="column-width">140mm</xsl:attribute>
</xsl:if>
<xsl:if test="//Options/@FopOutputFormat = 'rtf' and //Options/@PageOrientation = 'landscape'">
<!-- For RTF, force the size -->
<xsl:attribute name="column-width">230mm</xsl:attribute>
</xsl:if>
</fo:table-column>

<fo:table-body>
<!-- Report Description -->
<xsl:if test="ReportDescription != ''">
<fo:table-row>
<fo:table-cell>
<fo:block font-weight="bold">
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@RestrDescrTableTitle"/>
</xsl:attribute>
<xsl:value-of select="//Labels/@ReportDescription"/>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-bottom="2mm" padding-start="1mm">
<fo:block>
<xsl:value-of select="ReportDescription"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<!-- Report Restrictions -->
<xsl:if test="ReportRestrictions != ''">
<fo:table-row>
<fo:table-cell>
<fo:block font-weight="bold">
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@RestrDescrTableTitle"/>
</xsl:attribute>
<xsl:value-of select="//Labels/@ReportRestrictions"/>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-bottom="1mm" padding-start="1mm">
<fo:block>
<xsl:value-of select="ReportRestrictions"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<!-- Security Restrictions -->
<xsl:if test="SecurityRestrictions != ''">
<fo:table-row>
<fo:table-cell>
<fo:block font-weight="bold">
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@RestrDescrTableTitle"/>
</xsl:attribute>
<xsl:value-of select="//Labels/@SecurityRestrictions"/>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-start="1mm">
<fo:block>
<xsl:value-of select="SecurityRestrictions"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
</fo:table-body>
</fo:table>
</xsl:if>

<!-- Table of contents -->
<xsl:choose>
<xsl:when test="TableOfContents/table/tr[@rownumber=1]/@rownumber > 0">
<xsl:apply-templates select="TableOfContents/table"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="Page"/>
</xsl:otherwise>
</xsl:choose>

<!-- InformationTable: comments, record count, execution date, warning -->
<xsl:if test="//Options/@FopOutputFormat = 'rtf'">
<!-- Workaround to handle PageBreak/Line Feed for RTF: write an invisible character -->
<fo:block color="white">_</fo:block>
</xsl:if>

<xsl:if test="ReportComment != '' or //Visibility/@ShowRecordCount = 'visible' or //Visibility/@ShowExecutionDateTime = 'visible' or //Visibility/@ShowExecutionDateTime = 'visible' or ReportWarningMsg != ''">
<fo:table space-before.optimum="12pt" space-after.optimum="6pt" table-layout="fixed" width="100%">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@InformationTable"/>
</xsl:attribute>
<fo:table-column column-width="60mm"/>
<fo:table-column>
<xsl:if test="//Options/@FopOutputFormat = 'rtf' and //Options/@PageOrientation = 'portrait'">
<!-- For RTF, force the size -->
<xsl:attribute name="column-width">120mm</xsl:attribute>
</xsl:if>
<xsl:if test="//Options/@FopOutputFormat = 'rtf' and //Options/@PageOrientation = 'landscape'">
<!-- For RTF, force the size -->
<xsl:attribute name="column-width">210mm</xsl:attribute>
</xsl:if>
</fo:table-column>
<fo:table-body>
<!-- Comment -->
<xsl:if test="ReportComment != ''">
<fo:table-row>
<fo:table-cell padding-top="2mm" padding-start="1mm">
<fo:block font-weight="bold">
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@InformationTableTitle"/>
</xsl:attribute>
<xsl:value-of select="//Labels/@ReportComment"/>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-top="2mm" padding-start="1mm">
<fo:block>
<xsl:value-of select="ReportComment"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<!-- Record count -->
<xsl:if test="//Visibility/@ShowRecordCount = 'visible'">
<fo:table-row>
<fo:table-cell padding-top="2mm" padding-start="1mm">
<fo:block font-weight="bold">
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@InformationTableTitle"/>
</xsl:attribute>
<xsl:value-of select="//Labels/@RecordCount"/>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-top="2mm" padding-start="1mm">
<fo:block>
<xsl:value-of select="RecordCount"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<!-- Execution date time -->
<xsl:if test="//Visibility/@ShowExecutionDateTime = 'visible'">
<fo:table-row>
<fo:table-cell padding-top="2mm" padding-start="1mm">
<fo:block font-weight="bold">
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@InformationTableTitle"/>
</xsl:attribute>
<xsl:value-of select="//Labels/@ExecutionDateTime"/>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-top="2mm" padding-start="1mm">
<fo:block>
<xsl:value-of select="ReportExecDateTime"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<!-- Warning -->
<xsl:if test="ReportWarningMsg != ''">
<fo:table-row>
<fo:table-cell padding-top="2mm" padding-start="1mm" number-columns-spanned="2">
<fo:block font-weight="bold" color="red">
<xsl:value-of select="ReportWarningMsg"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
</fo:table-body>
</fo:table>
</xsl:if>

<xsl:if test="TableOfContents/table/tr[@rownumber=1]/@rownumber > 0">
<xsl:apply-templates select="Page"/>
</xsl:if>
</fo:block>
<fo:block id="endofdoc"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>


<!-- Page template -->
<xsl:template match="Page">
<!-- Force a page break for new page -->
<xsl:if test="//TableOfContents/table/tr[@rownumber=1]/@rownumber > 0">
<fo:block break-before="page"/>
</xsl:if>

<xsl:if test="//Options/@FopOutputFormat = 'rtf'">
<!-- Workaround to handle PageBreak/Line Feed for RTF: write an invisible character -->
<fo:block color="white">_&#13;&#10;&#13;&#10;</fo:block>
</xsl:if>
<fo:block>
<xsl:attribute name="id">BM<xsl:value-of select="@pagenumber"/></xsl:attribute>
<xsl:apply-templates select="PageTable/table"/>
<xsl:apply-templates select="MainChart"/>

<fo:block>
<xsl:attribute name="font-family">
<xsl:value-of select="//MainTable/@FontFamily"/>
</xsl:attribute>
<xsl:attribute name="font-size">
<xsl:value-of select="//MainTable/@FontSize"/>
</xsl:attribute>
<xsl:apply-templates select="MainTable/table"/>
</fo:block>
</fo:block>

<!-- Page information: page record count, back to top -->
<xsl:if test="@pagenumber > 0">
<xsl:if test="//Options/@FopOutputFormat = 'rtf'">
<!-- Workaround to handle PageBreak/Line Feed for RTF: write an invisible character -->
<fo:block color="white">_</fo:block>
</xsl:if>
<fo:table space-before.optimum="12pt" table-layout="fixed" width="100%">
<fo:table-column column-width="80mm"/>
<fo:table-column>
<xsl:if test="//Options/@FopOutputFormat = 'rtf' and //Options/@PageOrientation = 'portrait'">
<!-- For RTF, force the size -->
<xsl:attribute name="column-width">90mm</xsl:attribute>
</xsl:if>
<xsl:if test="//Options/@FopOutputFormat = 'rtf' and //Options/@PageOrientation = 'landscape'">
<!-- For RTF, force the size -->
<xsl:attribute name="column-width">190mm</xsl:attribute>
</xsl:if>
</fo:table-column>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block font-weight="bold">
<xsl:if test="//Visibility/@ShowPageRecordCount = 'visible'">
<xsl:value-of select="//Labels/@PageRecordCount"/>:<xsl:value-of select="PageRecordCount"/>
</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="right" font-weight="bold">
<xsl:if test="//Visibility/@ShowBackToTop = 'visible'">
<xsl:attribute name="color">
<xsl:value-of select="//Main/@HyperlinkColor"/>
</xsl:attribute>
<fo:basic-link internal-destination="Top">
<xsl:value-of select="//Labels/@Backtotop"/>
</fo:basic-link>
</xsl:if>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:if>
</xsl:template>


<!-- Table of contents table -->
<xsl:template match="TableOfContents/table">
<fo:block space-before.optimum="6pt" font-weight="bold">
<xsl:value-of select="//Labels/@TableOfContents"/>
</fo:block>
<fo:table border-style="solid" table-layout="fixed" inline-progression-dimension.maximum="100%">
<xsl:attribute name="border-width">
<xsl:value-of select="//Main/@TOCCellBorderWidth"/>
</xsl:attribute>
<xsl:attribute name="border-color">
<xsl:value-of select="//Main/@TOCCellBorderColor"/>
</xsl:attribute>
<fo:table-body>
<xsl:apply-templates select="tr"/>
</fo:table-body>
</fo:table>
</xsl:template>


<!-- Page table -->
<xsl:template match="PageTable/table">
<fo:table table-layout="fixed" space-before.optimum="12pt" inline-progression-dimension.maximum="100%">
<fo:table-column column-width="40mm"/>
<fo:table-column column-width="60mm"/>
<fo:table-body>
<xsl:apply-templates select="tr"/>
</fo:table-body>
</fo:table>
</xsl:template>


<!-- Main chart -->
<xsl:template match="MainChart">
<xsl:if test="//Options/@FopOutputFormat = 'rtf'">
<!-- Workaround to handle PageBreak/Line Feed for RTF: write an invisible character -->
<fo:block color="white">_</fo:block>
</xsl:if>
<xsl:if test="img/@src != ''">
<fo:external-graphic border-color="black" border-style="solid" border-width="0.75mm" >
<xsl:attribute name="src">
<xsl:value-of select="img/@src" />
</xsl:attribute>
</fo:external-graphic>
</xsl:if>
</xsl:template>


<!-- Main table -->
<xsl:template match="MainTable/table">
<xsl:if test="//Options/@FopOutputFormat = 'rtf'">
<!-- Workaround to handle PageBreak/Line Feed for RTF: write an invisible character -->
<fo:block color="white">_</fo:block>
</xsl:if>

<fo:table border-style="solid" table-layout="fixed" space-before.optimum="6pt" inline-progression-dimension.maximum="100%">
<xsl:attribute name="border-width">
<xsl:value-of select="$CellBorderWidth"/>
</xsl:attribute>
<xsl:attribute name="border-color">
<xsl:value-of select="$CellBorderColor"/>
</xsl:attribute>
<!-- Column width: limit the number of columns, the trick is to count the columns of the last line where we do not have col span -->
<xsl:variable name="colNumber" select="count(tr[@rownumber=count(../tr)]/td)"/>
<xsl:for-each select="//MainTable/Column[@Id&lt;=$colNumber]">
<fo:table-column>
<xsl:if test="@Width != ''">
<xsl:attribute name="column-width">
<xsl:value-of select="@Width"/>
</xsl:attribute>
</xsl:if>
</fo:table-column>
</xsl:for-each>

<xsl:choose>
<xsl:when test="//Options/@MainTableHeaderRows > 0">
<fo:table-header>
<xsl:apply-templates select="tr[@rownumber&lt;=//Options/@MainTableHeaderRows]"/>
</fo:table-header>

<fo:table-body>
<xsl:apply-templates select="tr[@rownumber>//Options/@MainTableHeaderRows]"/>
<xsl:if test="count(tr[@rownumber>//Options/@MainTableHeaderRows]) = 0">
<!-- Add dummy row if necessary -->
<fo:table-row><fo:table-cell><fo:block/></fo:table-cell></fo:table-row>
</xsl:if>
</fo:table-body>
</xsl:when>
<xsl:otherwise>
<fo:table-body>
<xsl:apply-templates select="tr"/>
</fo:table-body>
</xsl:otherwise>
</xsl:choose>
</fo:table>
</xsl:template>


<!-- Row table processing -->
<xsl:template match="tr">
<fo:table-row>
<xsl:for-each select="td">
<fo:table-cell border-style="solid" padding-top="1mm" padding-start="1mm" padding-bottom="1mm" padding-end="1mm">
<!-- Row and column span -->
<xsl:if test="@rowspan > 0">
<xsl:attribute name="number-rows-spanned">
<xsl:value-of select="@rowspan"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="@colspan > 0">
<xsl:attribute name="number-columns-spanned">
<xsl:value-of select="@colspan"/>
</xsl:attribute>
</xsl:if>

<!-- Cell border color and width-->
<xsl:choose>
<xsl:when test="@cellstyle = 'TableOfContentsTitle' or @cellstyle = 'TableOfContentsValue'">
<xsl:attribute name="border-width">
<xsl:value-of select="//Main/@TOCCellBorderWidth"/>
</xsl:attribute>
<xsl:attribute name="border-color">
<xsl:value-of select="//Main/@TOCCellBorderColor"/>
</xsl:attribute>
</xsl:when >
<xsl:otherwise>
<xsl:attribute name="border-width">
<xsl:value-of select="$CellBorderWidth"/>
</xsl:attribute>
<xsl:attribute name="border-color">
<xsl:value-of select="$CellBorderColor"/>
</xsl:attribute>
</xsl:otherwise >
</xsl:choose>
<!-- Cell background color -->
<xsl:choose>
<xsl:when test="@cellstyle = 'FirstCell'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@FirstCell"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'TableOfContentsTitle'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@TableOfContentsTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'TableOfContentsValue'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@TableOfContentsValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'PageTitle'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@PageTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'PageValue'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@PageValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'ColTitle'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@ColTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'ColValue'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@ColValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'RowTitle'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@RowTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'RowValue'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@RowValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'DataTitle'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@DataTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'DataValue'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@DataValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'AggTitle'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@AggTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'AggValue'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@AggValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'SubTotalTitle'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@SubTotalTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'SubTotalValue'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@SubTotalValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'SubTotalTotalValue'">
<xsl:attribute name="background-color">
<xsl:value-of select="//CellBackgroundColor/@SubTotalTotalValue"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>

<!-- Cell font weight and color -->
<fo:block>
<xsl:choose>
<xsl:when test="@cellstyle = 'TableOfContentsTitle'">
<xsl:attribute name="font-weight">
<xsl:value-of select="//CellFontWeight/@TableOfContentsTitle"/>
</xsl:attribute>
<xsl:attribute name="font-style">
<xsl:value-of select="//CellFontStyle/@TableOfContentsTitle"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@TableOfContentsTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'TableOfContentsValue'">
<xsl:attribute name="font-weight">
<xsl:value-of select="//CellFontWeight/@TableOfContentsValue"/>
</xsl:attribute>
<xsl:attribute name="font-style">
<xsl:value-of select="//CellFontStyle/@TableOfContentsValue"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@TableOfContentsValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'PageTitle'">
<xsl:attribute name="font-weight">
<xsl:value-of select="//CellFontWeight/@PageTitle"/>
</xsl:attribute>
<xsl:attribute name="font-style">
<xsl:value-of select="//CellFontStyle/@PageTitle"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@PageTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'PageValue'">
<xsl:attribute name="font-weight">
<xsl:value-of select="//CellFontWeight/@PageValue"/>
</xsl:attribute>
<xsl:attribute name="font-style">
<xsl:value-of select="//CellFontStyle/@PageValue"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@PageValue"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'RowTitle'">
<xsl:if test="$CellFontWeightRowTitle != '' ">
<xsl:attribute name="font-weight">
<xsl:value-of select="$CellFontWeightRowTitle"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontStyleRowTitle != '' ">
<xsl:attribute name="font-style">
<xsl:value-of select="$CellFontStyleRowTitle"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontColorRowTitle != '' ">
<xsl:attribute name="color">
<xsl:value-of select="$CellFontColorRowTitle"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="@cellstyle = 'RowValue'">
<xsl:if test="$CellFontWeightRowValue != '' ">
<xsl:attribute name="font-weight">
<xsl:value-of select="$CellFontWeightRowValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontStyleRowValue != '' ">
<xsl:attribute name="font-style">
<xsl:value-of select="$CellFontStyleRowValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontColorRowValue != '' ">
<xsl:attribute name="color">
<xsl:value-of select="$CellFontColorRowValue"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="@cellstyle = 'ColTitle'">
<xsl:if test="$CellFontWeightColTitle != '' ">
<xsl:attribute name="font-weight">
<xsl:value-of select="$CellFontWeightColTitle"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontStyleColTitle != '' ">
<xsl:attribute name="font-style">
<xsl:value-of select="$CellFontStyleColTitle"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontColorColTitle != '' ">
<xsl:attribute name="color">
<xsl:value-of select="$CellFontColorColTitle"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="@cellstyle = 'ColValue'">
<xsl:if test="$CellFontWeightColValue != '' ">
<xsl:attribute name="font-weight">
<xsl:value-of select="$CellFontWeightColValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontStyleColValue != '' ">
<xsl:attribute name="font-style">
<xsl:value-of select="$CellFontStyleColValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontColorColValue != '' ">
<xsl:attribute name="color">
<xsl:value-of select="$CellFontColorColValue"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="@cellstyle = 'DataTitle'">
<xsl:if test="$CellFontWeightDataTitle != '' ">
<xsl:attribute name="font-weight">
<xsl:value-of select="$CellFontWeightDataTitle"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontStyleDataTitle != '' ">
<xsl:attribute name="font-style">
<xsl:value-of select="$CellFontStyleDataTitle"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontColorDataTitle != '' ">
<xsl:attribute name="color">
<xsl:value-of select="$CellFontColorDataTitle"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="@cellstyle = 'DataValue'">
<xsl:if test="$CellFontWeightDataValue != '' ">
<xsl:attribute name="font-weight">
<xsl:value-of select="$CellFontWeightDataValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontStyleDataValue != '' ">
<xsl:attribute name="font-style">
<xsl:value-of select="$CellFontStyleDataValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontColorDataValue != '' ">
<xsl:attribute name="color">
<xsl:value-of select="$CellFontColorDataValue"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="@cellstyle = 'AggTitle'">
<xsl:attribute name="font-weight">
<xsl:value-of select="//CellFontWeight/@AggTitle"/>
</xsl:attribute>
<xsl:attribute name="font-style">
<xsl:value-of select="//CellFontStyle/@AggTitle"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@AggTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'AggValue'">
<xsl:if test="$CellFontWeightAggValue != '' ">
<xsl:attribute name="font-weight">
<xsl:value-of select="$CellFontWeightAggValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontStyleAggValue != '' ">
<xsl:attribute name="font-style">
<xsl:value-of select="$CellFontStyleDataValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontColorAggValue != '' ">
<xsl:attribute name="color">
<xsl:value-of select="$CellFontColorAggValue"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="@cellstyle = 'SubTotalTitle'">
<xsl:attribute name="font-weight">
<xsl:value-of select="//CellFontWeight/@SubTotalTitle"/>
</xsl:attribute>
<xsl:attribute name="font-style">
<xsl:value-of select="//CellFontStyle/@SubTotalTitle"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@SubTotalTitle"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@cellstyle = 'SubTotalValue'">
<xsl:if test="$CellFontWeightSubTotalValue != '' ">
<xsl:attribute name="font-weight">
<xsl:value-of select="$CellFontWeightSubTotalValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontStyleSubTotalValue != '' ">
<xsl:attribute name="font-style">
<xsl:value-of select="$CellFontStyleSubTotalValue"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$CellFontColorSubTotalValue != '' ">
<xsl:attribute name="color">
<xsl:value-of select="$CellFontColorSubTotalValue"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="@cellstyle = 'SubTotalTotalValue'">
<xsl:attribute name="font-weight">
<xsl:value-of select="//CellFontWeight/@SubTotalTotalValue"/>
</xsl:attribute>
<xsl:attribute name="font-style">
<xsl:value-of select="//CellFontStyle/@SubTotalTotalValue"/>
</xsl:attribute>
<xsl:attribute name="color">
<xsl:value-of select="//CellFontColor/@SubTotalTotalValue"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>

<!-- Cell align-->
<xsl:choose>
<xsl:when test="@align = 'right'">
<xsl:attribute name="text-align">right</xsl:attribute>
</xsl:when>
<xsl:when test="@align = 'left'">
<xsl:attribute name="text-align">left</xsl:attribute>
</xsl:when>
<xsl:when test="@align = 'center'">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:when>
</xsl:choose>

<xsl:choose>
<xsl:when test="@pagenumber > 0">
<xsl:attribute name="font-weight">bold</xsl:attribute>
<fo:basic-link>
<xsl:attribute name="color">
<xsl:value-of select="//Main/@HyperlinkColor"/>
</xsl:attribute>
<xsl:attribute name="internal-destination">BM<xsl:value-of select="@pagenumber" /></xsl:attribute>
<xsl:value-of select="."/>
</fo:basic-link>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</fo:block>

</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</xsl:template>


</xsl:stylesheet>

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.