After a lot of misery, a solution was born. Enjoy!
ZOOM IN PLEASE TO SEE IT!
Question
I have XML file that looks like this:
<platz>
<platzdesc>
<code>1</code>
<name>Alle</name>
</platzdesc>
<platzdesc>
<code>2</code>
<name>Gold</name>
</platzdesc>
</platz>
I need to write XSLT file to transform this XML into 3 column output. As I am not very good at XSLT can you please help me, I have tried various things but non of them work. Output is not HTML page but PDF.
Here is what I tried so far:
<fo:block padding-before = "8pt" padding-start ="50pt">
<xsl:for-each select="root/platz/platzdesc">
<fo:block>
<xsl:value-of select="concat(code,' - ', name)" />
</fo:block>
</xsl:for-each>
</fo:block>
I am working on a better solution but your help is welcome.
Solution 2
After a lot of misery, a solution was born. Enjoy!
ZOOM IN PLEASE TO SEE IT!
OTHER TIPS
As suggested already by @Navin Ravat, you could use a table.
This is the general structure of a table in XSL-FO:
<fo:table xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:table-column width="50mm"/>
<fo:table-column width="50mm"/>
<fo:table-column width="50mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block/>
</fo:table-cell>
<fo:table-cell>
<fo:block/>
</fo:table-cell>
<fo:table-cell>
<fo:block/>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
Above is a simple example table with just one row, you can add more of course. Now you have to incorporate this structure into your XSLT stylesheet. For instance, like this:
<xsl:element name="fo:table">
<xsl:element name="fo:table-column">
<xsl:attribute name="width">50mm</xsl:attribute>
</xsl:element>
<xsl:element name="fo:table-column">
<xsl:attribute name="width">50mm</xsl:attribute>
</xsl:element>
<xsl:element name="fo:table-column">
<xsl:attribute name="width">50mm</xsl:attribute>
</xsl:element>
<xsl:element name="fo:table-body">
<xsl:element name="fo:table-row">
<xsl:element name="fo:table-cell">
<xsl:element name="fo:block">
<xsl:value-of select="platz/platzdesc[code=2]"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>