Macros
Macros allow you to reuse parts of your style sheet by breaking it up in named parts. Listing 20.18 shows a simple macro that sets the content inside a box.
Listing 20.18 A Simple XSL Macro
1: <xsl:define-macro name="special-para"> 2: <fo:block-level-box 3: space-before-optimum="8pt" 4: space-after-optimum="8pt" 5: graphic-line-thickness='1.5pt'> 6: <xsl:contents/> 7: </fo:block-level-box> 8: </xsl:define-macro>
You can then call this macro whenever you need it, as shown in Listing 20.19.
Listing 20.19 Calling an XSL Macro
1: <xsl:template match="para"> 2: <xsl:invoke macro="special-para"> 3: <xsl:apply-templates/> 4: </xsl:invoke> 5: </xsl:template>