Код вот (не знаю насколько простой - меньше нету): Код | <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo" xmlns:datetime="http://exslt.org/dates-and-times"> <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
<xsl:variable name="descriptions"> <xsl:value-of select="count(//rows/row[position()=1]/child::*)"/> </xsl:variable>
<xsl:template match="rows"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set background-color="grey"> <fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="1.5cm" margin-bottom="1.5cm" margin-left="1cm" margin-right="1cm" background-color="grey"> <fo:region-body margin-top="0mm" margin-bottom="15mm" margin-left="0mm" margin-right="0mm"/> <fo:region-after extent="10mm"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="simpleA4" background-color="grey">
<fo:static-content flow-name="xsl-region-after"> <fo:block text-align="right"> <fo:page-number/> <xsl:text> из </xsl:text> <fo:page-number-citation ref-id="last-page"/> </fo:block> </fo:static-content>
<fo:flow flow-name="xsl-region-body"> <fo:block font-size="7pt">
<xsl:variable name="width" select="concat(19 div $descriptions, 'cm')"/>
<fo:table table-layout="fixed">
<xsl:for-each select="./row[position()=1]"> <xsl:for-each select="child::*"> <fo:table-column> <xsl:attribute name="column-width"> <xsl:value-of select="$width"/> </xsl:attribute> </fo:table-column> </xsl:for-each> </xsl:for-each>
<fo:table-header background-color="rgb(51,102,153)">
<fo:table-row>
<xsl:for-each select="./row[position()=1]"> <xsl:for-each select="child::*">
<fo:table-cell padding-top="3mm" padding-bottom="3mm" padding-right="1mm" padding-left="1mm" border-color="rgb(255,251,213)" border-bottom-width="0pt" border-top-width="0pt" border-left-width="0px" border-style="solid" display-align="center"> <xsl:choose> <xsl:when test="position() = $descriptions"> <xsl:attribute name="border-right-width"> 0px </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="border-right-width"> 1px </xsl:attribute> </xsl:otherwise> </xsl:choose>
<fo:inline color="rgb(255,255,255)"> <fo:block text-align="center" font-weight="bold"> <xsl:value-of select="@description"/> <xsl:for-each select="./rows"> <xsl:for-each select="./row/property"> <xsl:value-of select="@description"/> </xsl:for-each> </xsl:for-each> </fo:block> </fo:inline>
</fo:table-cell> </xsl:for-each> </xsl:for-each> </fo:table-row>
</fo:table-header>
<fo:table-body> <xsl:apply-templates select="row"/> </fo:table-body>
</fo:table>
</fo:block>
<fo:block id="last-page"/>
</fo:flow> </fo:page-sequence> </fo:root> </xsl:template>
<xsl:template match="row"> <fo:table-row>
<xsl:choose> <xsl:when test="position() mod 2 = 1"> <xsl:attribute name="background-color"> rgb(255,255,255) </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="background-color"> rgb(239,239,239) </xsl:attribute> </xsl:otherwise> </xsl:choose>
<xsl:for-each select="property"> <xsl:variable name="x" select="@type"/> <fo:table-cell padding-right="1mm" padding-left="1mm" border-color="rgb(255,251,213)" border-bottom-width="0pt" border-top-width="1pt" border-left-width="0px" border-right-width="1px" border-style="solid" padding-top="1mm" padding-bottom="1mm"> <xsl:choose> <xsl:when test="position() = $descriptions"> <xsl:attribute name="border-right-width"> 0px </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="border-right-width"> 1px </xsl:attribute> </xsl:otherwise> </xsl:choose> <fo:block> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="$x=6">right</xsl:when> <xsl:otherwise>left</xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:value-of select="./text()" disable-output-escaping="yes"/> </fo:block> </fo:table-cell> </xsl:for-each> </fo:table-row> </xsl:template> </xsl:stylesheet>
|
Я пользуюсь FOP . Зайдите на www.w3c.org и почитайте про XSL/XSL-FO - там и спецификация, и описание процессоров и много других полезных ресурсов и ссылок.
--------------------
Теперь при чем :P
|