How to reuse template code

Hi

I am new to XSL-FO and was hoping somebody would be kind enough to answer
the following questions.  I have read a number of online tutorials but they
do not go above a very basic introduction.  I have been using xml and xslt
files so as to separate my content and format. 

1)Suppose you have two paragraphs which have identical formatting e.g. font
size, colour, style except that one paragraph begins with has different
alignment.  At the moment I am writing two templates e.g.

<xsl:template match="para1">
       <fo:block text-indent="0.5in" 
          font-size="12pt" 
                 font-family="sans-serif" 
                 line-height="15pt"
                 space-after.optimum="12pt"
                 text-align="right">
  <xsl:value-of select="."/>
 </fo:block>
</xsl:template>

and 

<xsl:template match="para2">
       <fo:block font-size="12pt" 
                 font-family="sans-serif" 
                 line-height="15pt"
                 space-after.optimum="12pt"
                 text-align="right">
  <xsl:value-of select="."/>
 </fo:block>
</xsl:template>

Is there no way of saying apply all of the template specification in para1
to para2 but change the alignment with repeating the same styling
definitions?    Ddo I have to write separate templates every time
regardless?

2)If I want to apply exactly the same template, do I have to copy the whole
template and change the XPath query?  Is there no way I can reuse the same
template by sating something like:

<apply template select =“para”><value-of=/nodeA></apply template>
<apply template select =“para”><value-of=nodeJ></apply template>

--
View this message in context: http://www.nabble.com/How-to-reuse-template-code-t1620380.html#a4390495
Sent from the w3.org - www-xsl-fo forum at Nabble.com.

Received on Monday, 15 May 2006 11:40:17 UTC