Auto-numbering in tablesHi, Here is an example of customizing the profiling stylesheet:
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'> <xsl:import href="../docbook-xsl-1.74.0/profiling/profile.xsl"/> <xsl:template mode="profile" match="[EMAIL PROTECTED] = 'autonumbered']/tgroup/tbody/row/entry[1]"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:number count="row" level="single" from="tbody"/> </xsl:copy> </xsl:template> </xsl:stylesheet> You need to use the two-step profiling method, where you process your document with this stylesheet first, and then process the result with your formatting stylesheet. Bob Stayton Sagehill Enterprises [EMAIL PROTECTED] ----- Original Message ----- From: [EMAIL PROTECTED] To: [email protected] Sent: Wednesday, July 30, 2008 9:38 AM Subject: [docbook-apps] Auto-numbering in tables Hi people, I found the thread below using google, and it describes exactly what I need to do for generating PDF files using docbook-xsl-1.73.2. However, I can't get the numbers to appear in tables. I've put the xsl:template code in both fo/profile-docbook.xsl and fo/table.xsl but with no luck. (And yes I've replaced the [EMAIL PROTECTED] with table[atrole=). Any suggestions as to why? My table in the .xml looks like this: <table role="autonumbered"> <title>Blah</title> <tgroup cols='5' align='left' colsep='1' rowsep='1'> <thead> <row> <entry>ID</entry> <entry>Blah</entry> <entry>Blah</entry> <entry>Blah</entry> <entry>Blah</entry> </row> </thead> <tbody> <row> <entry></entry> <entry>ditto</entry> <entry>ditto</entry> <entry>ditto</entry> <entry>ditto</entry> </row> <row> <entry></entry> <entry>ditto</entry> <entry>ditto</entry> <entry>ditto</entry> <entry>ditto</entry> </row> </tbody> </tgroup> </table> Can someone maybe elaborate where Jirka says "Simply create stylesheet customization based on profiling stylesheet (like fo/profile-docbook.xsl or html/profile-chunk.xsl)"? Dave Cushman wrote: > Instead of manually entering the item number in the first column, I'd > like to be able to have that generated during conversion so that it > stays accurate as I add and remove items. What is a good method to > accomplish this? It's kind of a hack but you can attach this autonumbering functionality to profiling code in stylesheets. Simply create stylesheet customization based on profiling stylesheet (like fo/profile-docbook.xsl or html/profile-chunk.xsl) and then add special role to tables that should have this functionality, like: <table role="autonumbered"> and in your customized stylesheet use the following template: <xsl:template match="[EMAIL PROTECTED]'autonumbered']/tgroup/tbody/row/entry[1]" mode="profile"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:number count="row" level="single" from="tbody"/> </xsl:copy> </xsl:template> Regards James
