[2.7.13] Macros

I see in [2.7.13] that macros are "parts of templates" ... would it be
possible to add that macros can define templates themselves:

<xsl:define-macro name="list-item-label">
    <xsl:choose>
        <xsl:when test='ancestor(list[attribute(type)="OL"]
                                /list[attribute(type)="OL"]'>
            <xsl:number format="a"/>
        </xsl:when>
        <xsl:when test='ancestor(list[attribute(type)="OL"]'>
            <xsl:number format="i"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:number format="1"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:define-macro>    

<xsl:define-macro name="list-templates">
   <xsl:template match='list[attribute(type)="{arg(type)}"]
                        /li[first-of-type()]'>
     <fo:list-item space-before="10pt" 
                   indent-start="{constant(indent-step)}">
        <xsl:contents/>
        <xsl:process-children/>     <!-- contents of the list item -->
     </fo:list-item>
   </xsl:template>
</xsl:define-macro>

<xsl:invoke name="list-templates">
    <xsl:arg name="type" value="OL"/>
    <fo:list-item-label>
        <fo:invoke macro="list-item-label"/>
    </fo:list-item-label>
</xsl:invoke>

<xsl:invoke name="list-templates">
    <xsl:arg name="type" value="UL"/>
    <fo:list-item-label>
        <xsl:text>&#x00B7;</xsl:text>
    </fo:list-item-label>
</xsl:invoke>

The above allows me to maintain a single definition of the fo:list-item
attributes across the different list item types of an Ordered List ("OL")
and an UnorderedList ("UL").

........... Ken


--
G. Ken Holman               mailto:gkholman@CanadaMail.com
Crane Softwrights Ltd.  http://www.CraneSoftwrights.com/s/
Box 266,                                V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0            F: +1(613)489-0995
Training:   http://www.CraneSoftwrights.com/s/schedule.htm
Resources: http://www.CraneSoftwrights.com/s/resources.htm
Shareware: http://www.CraneSoftwrights.com/s/shareware.htm

Received on Saturday, 12 September 1998 08:51:19 UTC