[Accessibility conventions are described at the bottom of the page]

A. Using XSLT with XSL-FO
[> B.][< 13.3.1][^^^]
A.0 Using XSLT with XSL-FO
[> A.1][> B.][< A.][^^][^^^]
XSLT was designed primarily for use with XSL-FO
[[1] - result of an XSLT transform is an XML information set that may or may not be serialized as XML syntax
[[2] - result information set can be delivered to XSL-FO formatter without serialization
][1] - a number of features of XSLT assist the writing of XSL-FO stylesheets
 [1] - the design of XSL-FO is made simpler by the use of XSLT functionality
]
XSLT is a normative part of XSL
[[1] - section 2.1 of XSL states the following:
[[2] - The provisions in "XSL Transformations" form an integral part of this recommendation and are considered normative.
]]
Certain aspects of XSL-FO are defined by XSLT
[[1] - references are made in XSL-FO to sections of XSLT for their definition
 [1] - design decisions in XSL-FO pattern themselves after XSLT definitions
]
No technical reason that XSLT must be used to create XSL-FO
[[1] - the formatter can accept an instance of XSL-FO regardless of how that instance was generated
]
A.1 XSLT language features supporting XSL-FO
[> A.2][< A.0][^^][^^^]
A.1.1 <xsl:attribute-set> instruction
[> A.1.2][> A.2][> B.][< A.0][^^][^^^]
<xsl:attribute-set> is a very useful instruction for the manipulation of many attributes targeted for a given formatting object:
[[1] - names a set of attribute instructions that can be called on demand
 [1] - uses a namespace-qualified name promoting the easy sharing of stylesheet fragments
 [1] - well-defined integration with other methods of specifying attributes for a result element
[[2] - any <xsl:attribute-set> collections named in an xsl:use-attribute-sets= attribute are added first
 [2] - any attribute specifications in the literal result element itself are added next
 [2] - any executed <xsl:attribute> instructions in the literal result element's template are added last
 [2] - earlier defined attribute values are replaced with later defined values without an error
 [2] - last value assigned to an attribute is what remains in the result tree
]]
A.1.2 Simpler list and footnote structures in XSL-FO
[> A.2][> B.][< A.1.1][^][^^][^^^]
The numbering facilities in XSLT allow the list structures in XSL-FO to be more simply defined:
[[1] - the collection of list formatting objects are layout oriented, not content oriented
[[2] - a list is a list regardless of how it is labeled or what it contains
][1] - the content of the objects is defined by XSLT, thereby reducing number of objects
[[2] - no distinction between numbered and unnumbered lists
 [2] - the type and structure of the list item labels is entirely out of the scope of the formatting and rendering
]]
The semantics of footnote citation numbering are not part of XSL-FO
[[1] - the value of the footnote citation is determined by the transformation process, not by the formatting process
[[2] - a drawback is that this prevents footnote numbering from being page-based
]]
A.2 XSL-FO language features similar to XSLT and XPath
[> B.][< A.1.2][^^][^^^]
A.2.1 Common errors writing expressions
[> B.][< A.1.2][^^][^^^]
The expression language is very close, but not identical:
[[1] - same operators
 [1] - wider set of operands in XSL-FO than XPath
]
Nuances of differences can make the writing of XSLT confusing
[[1] - triggers stylesheet errors
]
[Example A-1: An illustration of uses of the expression language with lengths Consider the situation of arithmetic calculations with lengths:
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="10pt div 2">
06  First test: <xsl:value-of select="$num div 2"/>
07  </block>
08  
09  <block space-before="{$medium-font} div 2">
10  Second test
11  </block>
12  
13  <block space-before="{$medium-font div 2}">
14  Third test
15  </block>
16  
17  <block>
18   <xsl:attribute name="space-before">
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">
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 for the third and fourth tests above
[[1] - the arithmetic calculation yields the NaN result because a length is not a number in XSLT as in XSL-FO
[[2] - XSLT cannot do arithmetic operations with string operands
][1] - a formatter may not report an error and assume a value of 0 for NaN since it is a valid number in the numbering system
[[2] - no indication to the stylesheet writer that anything is wrong, yet results are not as expected and no error messages to diagnose
]]


This is an accessible version of Crane's commercial training material. The content has been specifically designed to assist screen reader software in viewing the entire textual content. Figures are replaced with text narratives.

Navigation hints are in square brackets:
[Tx.x] and [Fx.x] are textual representations of the applicability icons;
[digit] indicates list depth for nested lists;
[link [URL]] indicates the URL of a hyperlink if different than link;
[EXAMPLE] indicates an example listing of code;
[FIGURE] indicates the presence of a figure replaced by its description;
[>] jumps forward;
[<] jumps backward;
[^] jumps to start of the section;
[^^] jumps to the start of the chapter;
[^^^] jumps to the table of contents.
Suggestions for improvement are welcome: [info@CraneSoftwrights.com]
Book sales: [http://www.CraneSoftwrights.com/links/trn-acc.htm]
Information: [http://www.CraneSoftwrights.com/links/info-acc.htm]
This content is protected by copyright and, as there are no means to protect this accessible version from plagiarism, please do not make any commercial edition available to others.

+//ISBN 978-1-894049::CSL::Courses::PFUX//DOCUMENT Practical Formatting Using XSL-FO 2008-01-27 17:30UTC//EN
Practical Formatting Using XSL-FO
Seventh Edition - 2008-01-27
ISBN 978-1-894049-19-1
Copyright © Crane Softwrights Ltd.