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] formatting for paragraphs with xsl stylesheets


Thanks Bob,

When I look at this page:

http://docbook.sourceforge.net/release/xsl/1.76.1/doc/fo/index.html

I don't see the normal.para.properties attribute set at all. Is the documentation not accurate?

Paul

On Fri, Mar 2, 2012 at 12:35 PM, Bob Stayton <bobs@sagehill.net> wrote:
Hi Paul,
I think the normal.para.spacing attribute-set was originally for para, but has since been used for other purposes to give uniform spacing for several similar elements. There should be a dedicated attribute-set for para which has a use-attribute-sets="normal.para.spacing" attribute so it can use those properties but provide an opportunity for further customization for just para.
 
Looking at some of my previous cusotmization, I have used the normal.para.properties attribute set and add an xsl:choose to test for the para context, something like this:
 
<xsl:attribute-set name="normal.para.properties">
  <xsl:attribute name="text-indent">
    <xsl:choose>
      <xsl:when test="self::d:para">
          para value
      </xsl:when>
      </xsl:otherwise>
          non-para value
      </xsl:otherwise>
    </xsl:choose>
  </xsl:attribute>
</xsl:attribute-set>
 
Since attribute-sets of the same name are merged, you will still get the spacing and add this property.
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
 
 
----- Original Message -----
Sent: Friday, March 02, 2012 7:21 AM
Subject: [docbook-apps] formatting for paragraphs with xsl stylesheets

It seems that the xsl stylesheets have a shortcoming for formatting paragraphs. Whereas all other elements have an attribute set, para does not.

In order to set formatting properties, one has to use the section.properties attribute set. But then titles inherit this property as well. For example:

    <xsl:attribute-set name="section.properties">
      <xsl:attribute name="text-indent">12pt</attribute>
    </xsl:attribute-set name>


Ends up indenting the title as well. In order to get around that, I have to set the text-indent on the title properties to 0; that seems like a clumsy workaround. In addition, the lack of formatting for paragraphs does not allow you to indent paragraphs in certain situations. For example, some styles don't indent the first paragraph after a title.

The code below is my workaround. Is there a better way? If not, I would consider submitting a patch (in which case the code would be more sophisticated to handle more complicated situations)



 
 <!--indent first paragraph-->
    <xsl:template match="d:para">
        <xsl:variable name="keep.together">
            <xsl:call-template name="pi.dbfo_keep-together"/>
        </xsl:variable>
        <fo:block xsl:use-attribute-sets="normal.para.spacing">
            <xsl:if test="$keep.together != ''">
                <xsl:attribute name="keep-together.within-column">
                    <xsl:value-of select="$keep.together"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="preceding-sibling::d:para">
                <xsl:attribute name="text-indent">
                    <xsl:value-of select="$text-indent"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:call-template name="anchor"/>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>

Paul



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