OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Creating customized "itemizedlist" ...


Hello Dick,

Thank you for your reply. I will try it out this way.
I am adding customized elements because, besides documentation, these need to be further processed in our applications.

Regards,
Anagha


Dick Hamilton wrote:
Message
Anagha,
 
The code you included below has a few problems:
 
- I wouldn't combine the itemizedlist and parlist templates;
  Rather, I'd copy the itemizedlist template and turn it into
  a separate parlist template.
- Then, you can replace matches for listitem with matches
  for paritem and not worry about adding matches inside that
  template.
- You need to copy and modify the template that matches
  itemizedlist/listitem to match parlist/paritem.
 
One thought: If you're doing this to learn more about the docbook
stylesheets and XSL, then this is a good exercise.  But if your
purpose is simply to get a parameter list, you may want to consider
a different approach that is MUCH easier.
 
Why not just use the existing <parameter> element inside the list,
like this:
 
<itemizedlist>
  <listitem>
    <para><parameter>parameter 1</parameter></para>
  </listitem>
   more listitems ...
</itemizedlist>
 
That will render without any customization of DocBook or the
stylesheets.  Then, if you want parameters to look different,
you can customize the <parameter> element in your xsl, which
is much easier than adding a new list element.
 
Dick Hamilton
-----Original Message-----
From: Anagha Tongaonkar [mailto:anagha@3dgeo.com]
Sent: Thursday, March 13, 2008 4:35 PM
To: DocBook Apps; Dick Hamilton; Bob Stayton
Subject: [docbook-apps] Creating customized "itemizedlist" ...

Hello Folks,

I am trying to add a parameter list, which will have a list of parameters.
I added new element parlist by duplicating the existing element "itemizedlist" and I added, as it's member, an element "paritem" (
duplicated the existing element "listitem"). I have created a customized the XSL in order to see these newly-added elements in the PDF. However, the "paritem" elements do no appear in the PDF, they appear as XML fragments.

Do I need some more customizations in the XSL? Please advise.
Thank you,
Anagha
--------------------------------------------------------------
Customized XSL is as following:

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

<xsl:template match="itemizedlist|parlist">
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>
 
  <xsl:variable name="pi-label-width">
    <xsl:call-template name="pi.dbfo_label-width"/>
  </xsl:variable>
 
  <xsl:variable name="label-width">
    <xsl:choose>
      <xsl:when test="$pi-label-width = ''">
    <xsl:value-of select="$itemizedlist.label.width"/>
      </xsl:when>
      <xsl:otherwise>
    <xsl:value-of select="$pi-label-width"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
 
  <xsl:if test="title">
    <xsl:apply-templates select="title" mode="list.title.mode"/>
  </xsl:if>
 
  <!-- Preserve order of PIs and comments -->
  <xsl:apply-templates 
      select="*[not(self::listitem
                or self::title
                or self::titleabbrev)]
              |comment()[not(preceding-sibling::listitem)]
              |processing-instruction()[not(preceding-sibling::listitem)]"/>
 
  <xsl:variable name="content">
    <xsl:apply-templates 
          select="listitem
                  |comment()[preceding-sibling::listitem]
                  |processing-instruction()[preceding-sibling::listitem]"/>
  </xsl:variable>
 
  <!-- nested lists don't add extra list-block spacing -->
  <xsl:choose>
    <xsl:when test="ancestor::listitem">
      <fo:list-block id="{$id}" xsl:use-attribute-sets="itemizedlist.properties">
    <xsl:attribute name="provisional-distance-between-starts">
      <xsl:value-of select="$label-width"/>
    </xsl:attribute>
        <xsl:copy-of select="$content"/>
      </fo:list-block>
    </xsl:when>
    <xsl:otherwise>
      <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing itemizedlist.properties">
    <xsl:attribute name="provisional-distance-between-starts">
      <xsl:value-of select="$label-width"/>
    </xsl:attribute>
    <xsl:copy-of select="$content"/>
      </fo:list-block>
    </xsl:otherwise>
  </xsl:choose>
 
</xsl:template>

<xsl:template match="listitem/*[1][local-name()='para' or 
                                   local-name()='simpara' or 
                                   local-name()='formalpara']
                     |glossdef/*[1][local-name()='para' or 
                                   local-name()='simpara' or 
                                   local-name()='formalpara']
                     |step/*[1][local-name()='para' or 
                                   local-name()='simpara' or 
                                   local-name()='formalpara']
                     |callout/*[1][local-name()='para' or 
                                   local-name()='simpara' or 
                                   local-name()='formalpara']
                     |par
item/*[1][local-name()='para' or 
                                   local-name()='simpara' or 
                                   local-name()='formalpara']
"
              priority="2">
  <fo:block>
    <xsl:call-template name="anchor"/>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

</xsl:stylesheet>  
--------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]