I am transforming my XML document into PDF document thru Apache-FOP project, So far so good. Except, I am having which is not easy to configure later on. My code snippet is like this,
<fo:table-cell>
<fo:block margin-top="5pt" text-align="left"><xsl:value-of select="" /></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block margin-top="5pt" text-align="center"><xsl:value-of select="" /></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block margin-top="5pt" text-align="center"><xsl:value-of select="" /></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block margin-top="5pt" text-align="center"><xsl:value-of select="" /></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block margin-top="5pt" text-align="center"><xsl:value-of select="" /></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block margin-top="5pt" text-align="center"><xsl:value-of select="" /></fo:block>
</fo:table-cell>
As you can see in above code, I have margin-top="5pt" text-align="center"
quite often. I have tried to find a way so that I can write this values only once and later I can just change one variable which then affects everyone.
Research finding :
What I found so far is, that I can use a parameter in XSLT and define a variable. later, I can use, The parameter value can be 5pt. and then I use it like this.
<xsl:attribute name="margin-top">$var</xsl:attribute>
But this isn't a good solution as it make my code completely unreadable(well not completely, but you know what I mean). Is there anything like CSS in XSLT?