Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Generation of a table of contents using XSL - FOP (http://www.velocityreviews.com/forums/t515809-generation-of-a-table-of-contents-using-xsl-fop.html)

Avi 06-19-2007 07:56 PM

Generation of a table of contents using XSL - FOP
 
Hello,

I am trying to generate a TOC using FOP. I have a XML file as follows:

<?xml version="1.0" encoding="iso-8859-1"?>
<FILE>
<INTERFACE>
<NAME> A_B </NAME>
<MESSAGE> MSG_1 </MESSAGE>
<MESSAGE> MSG_2 </MESSAGE>
</INTERFACE>
</FILE>

I want to generate a pdf file with the table of contents as:

1. A_B
1.1 MSG_1............................................. ...1
1.2 MSG_2............................................. ...3

And these should be linked to the corresponding pages 1 and 3. Is it
possible to write an XSL file which could do it? I tried with the
following XSL file, but could not get the desired output.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="/">

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

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

<fo:page-sequence master-reference="simple">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates select="FILE"/>
</fo:flow>
</fo:page-sequence>

</fo:root>
</xsl:template>

<xsl:template match="FILE">
<fo:block font-size="12pt"
font-family="sans-serif"
line-height="15pt"
space-after.optimum="3pt"
text-align="justify"
padding-bottom="6pt">
<xsl:apply-templates select="TOC" />
</fo:block>
</xsl:template>

<xsl:template match="TOC">
<xsl:apply-templates select="//INTERFACE" mode="toc"/>
</xsl:template>

<xsl:template match="INTERFACE" mode="toc">
<xsl:for-each select="MESSAGE">
<xsl:number format="1.1.1. " level="multiple" from="s1"
count="INTERFACE|MESSAGE"/>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>


</xsl:stylesheet>


I could not find proper documentation. Could anybody help me wth this?



All times are GMT. The time now is 07:01 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.