473,395 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Generation of a table of contents using XSL - FOP

Avi
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>
<NAMEA_B </NAME>
<MESSAGEMSG_1 </MESSAGE>
<MESSAGEMSG_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?

Jun 19 '07 #1
0 3112

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steve_EE | last post by:
I'm running phpMyAdmin 2.5.3 / MySQL 4.0.14 / PHP 4.3.3 / Apache 1.3.20 phpMyAdmin is installed and appears ok at first, I can login, select databases, view which tables are in each db, see the...
2
by: Gert Schumann | last post by:
I want to delete just parts of tables, so I can't use 'TRUNCATE'. As I want to delete about millions of lines, I need a very big rollback segment. The best way would be to delete without using...
4
by: news.ntlworld.com | last post by:
Hi everyone. I'm trying to emulate a simple table layout using CSS only. This hyperlink (http://homepage.ntlworld.com/r.morris7/tabledemo.htm) shows the intended result, which I've knocked up using...
5
by: Gerry Abbott | last post by:
Hi all, Is it possible to have the table view hidden, but allow a user to view the table contents through a query or linked form ? Thanks in advance. Gerry Abbott
11
by: Michael Mayo | last post by:
I have a simple html page that contains an image in a single table cell, surrounded by a border: <http://www.softrains.com/lc/test.html>. I would like to eliminate the space between the table...
1
by: sachin10 | last post by:
hi i m sachin, i m new to VB programming.i face some problem regarding the sorting of text file contents using arrays.text file have data in the format as below seq...
2
by: veenaaecom | last post by:
Hi, I have a table A , table B and table C. Table B is kind of a bridge to table A and table C (i.e it has common columns that bridges table A and table C) I have a colun in table A whose value is...
13
by: ramprakashjava | last post by:
hi, i hav "java.lang.NullPointerException" error while Deleting table records using checkbox in jsp here i enclosed files help quickly plzzz.. ...
8
by: ananthaisin | last post by:
How to reduce the table size for any table while using truncate or delete statements. In oracle 8i it was truncating the storage space but in 10g it is not .... I have given truncate statement in...
1
by: dinesh1440 | last post by:
I have problem in retrieving word table contents in php. And I need to store them in database tables. Could someone please help me doing this???? Please give it in the code format rather as...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.