A.2 XSL-FO language features similar to XSLT and XPathThe expression language is very close, but not identical.
Nuances of differences can make writing in XSLT confusing;
Consider the situation of arithmetic calculations with lengths, as shown in Example A-1. Example A-1 An illustration of uses of the expression language with lengthsLine 01 <xsl:template name="test"> 02 <xsl:variable name="num" select="100"/> 03 <xsl:variable name="medium-font" select="'10pt'"/> 04 05 <block space-before.optimum="10pt div 2"> 06 First test: <xsl:value-of select="$num div 2"/> 07 </block> 08 09 <block space-before.optimum="{$medium-font} div 2"> 10 Second test 11 </block> 12 13 <block space-before.optimum="{$medium-font div 2}"> 14 Third test 15 </block> 16 17 <block> 18 <xsl:attribute name="space-before.optimum"> 19 <xsl:value-of select="$medium-font div 2"/> 20 </xsl:attribute> 21 Fourth test 22 </block> 23 24 <block> 25 <xsl:attribute name="space-before.optimum"> 26 <xsl:value-of select="$medium-font"/> div 2<xsl:text/> 27 </xsl:attribute> 28 Fifth test 29 </block> 30 </xsl:template> There will be no spacing in the third and fourth tests.
|