Hi,
I think you would be better off customizing just the template for term rather than the whole list. This is a copy of the template from fo/lists.xsl, modified (untested) to include your counting code:

<xsl:template match="varlistentry/term">
 <fo:inline>
   <xsl:call-template name="simple.xlink">
     <xsl:with-param name="content">
       <!-- Change this part -->
       <xsl:choose>
         <xsl:when test="parent::varlistentry/@role = 'REC'">
<!-- insert your text here -->
   <xsl:text>MYREC-</xsl:text>
   <xsl:variable name="rec-number">
     <xsl:number count="[EMAIL PROTECTED] = 'REC']" level="any"/>
   </xsl:variable>
   <xsl:number value="$rec-number" format="01"/>
         </xsl:when>
         <xsl:when test="parent::varlistentry/@role = 'REQ'">
<!-- something similar here -->
         </xsl:when>
         <xsl:otherwise>
           <xsl:apply-templates/>
         </xsl:otherwise>
     </xsl:with-param>
   </xsl:call-template>
 </fo:inline>
 <xsl:choose>
   <xsl:when test="not(following-sibling::term)"/> <!-- do nothing -->
   <xsl:otherwise>
<!-- * if we have multiple terms in the same varlistentry, generate -->
     <!-- * a separator (", " by default) and/or an additional line -->
     <!-- * break after each one except the last -->
<fo:inline><xsl:value-of select="$variablelist.term.separator"/></fo:inline>
     <xsl:if test="not($variablelist.term.break.after = '0')">
       <fo:block/>
     </xsl:if>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>


Bob Stayton
Sagehill Enterprises
[EMAIL PROTECTED]


----- Original Message ----- From: "Halm Reusser" <[EMAIL PROTECTED]>
To: "Bob Stayton" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Thursday, October 30, 2008 8:35 AM
Subject: Re: [docbook] Auto numbering lists


Hi Bob,


first thanks a lot for your time and your explanations.

I think, may be it can really easy be done by something like that.


dockbook snippet:

<para>
Some general text...

   <variablelist>

     <varlistentry role="REC">
       <term>REC-XX</term>
       <listitem>
         <para>
           Bla bla
         </para>
       </listitem>
     </varlistentry>

     <varlistentry role="REC">
       <term>REC-XX</term>
       <listitem>
         <para>
           Bla bla bla
         </para>
       </listitem>
     </varlistentry>

     <varlistentry role="REQ">
       <term>REQ-XX</term>
       <listitem>
         <para>
           Bla bla bla
         </para>
       </listitem>
     </varlistentry>

   </variablelist>

</para>


And then use an general (not output specific template) similar to:

<xsl:template match="[EMAIL PROTECTED] = 'REC']" mode="object.term.markup">
 <fo:block xsl:use-attribute-sets="special.varlistentry.term.attributes">
   <xsl:text>MYREC-</xsl:text>
   <xsl:variable name="rec-number">
     <xsl:number count="[EMAIL PROTECTED] = 'REC']" level="any"/>
   </xsl:variable>
   <xsl:number value="$rec-number" format="01"/>
 </fo:block>
</xsl:template>

same for REQs.


What is your opinion? Can this work? My template is wrong, do have an hint
or a resource where I can find more informations.


Thanks a lot in advance,
Halm



Bob Stayton wrote:
Hi,
Yes, this can work in a similar fashion for HTML output, as it uses
mode="object.title.markup" too.

Regarding learning XSLT, I use Michael Kay's XSLT Programmer's Reference
(2nd edition, not 3rd edition which covers XSLT 2.0).  I'm sure there
must be online XSLT manuals as well, but I've not used them.

The reference to mode="title.markup" is to a feature of the DocBook XSL
stylesheets that generates just the title for an element, as explained a
bit more in my book:

http://www.sagehill.net/docbookxsl/ReplaceTemplate.html#UtilityTemplates

It wasn't clear from your example if these REC and REQ items had titles,
so I said you could use this if you need to display the title.

Bob Stayton
Sagehill Enterprises
[EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to