|
Basic properties |
font properties
margin and spacing properties
border and padding properties
keeps/breaks
horizontal alignment/justification
indentation
more formatting object specific properties
XSL FO formatting capabilities in XSL 1.0 are approximately the union of:
HTML + CSS capabilities
most high quality print output capabilities including internationalization features
Not included are complex page layouts (e.g., magazine and newspaper layout), complex layout-driven formatting (e.g., copyfitting and complex floats), and looseleaf pagination (change page production)
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:include href="fo-root.xsl"/>
<xsl:template match="article">
<fo:page-sequence font-family="serif" font-size="12pt">
<xsl:apply-templates/>
</fo:page-sequence>
</xsl:template>
<xsl:template match="chapter">
<fo:flow>
<xsl:apply-templates/>
</fo:flow>
</xsl:template>
<xsl:template match="para">
<fo:block space-before="6pt">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="chapter/title">
<fo:block font-family="sans-serif" color="blue"
font-weight="bold" font-size="18pt"
space-after="0.5em">
<xsl:number level="multiple" count="chapter"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="section/title">
<fo:block font-family="sans-serif"
font-weight="bold" font-size="16pt"
space-after="0.5em">
<xsl:number level="multiple" count="chapter|section"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="article/title">
<fo:block font-family="sans-serif" font-size="24pt"
space-after="2pc">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
</xsl:stylesheet>
Performs a roughly textual include of the referenced stylesheet
The importing stylesheet "extends" the imported stylesheet
XSLT is a tree-to-tree transformation. It isn't specifically the job of the XSLT processor to write out a text representation (serialization) of the tree. However, XSLT does allow the stylesheet author to suggest the desired serialization procedure:
The selection of namespace aliases is controlled by <xsl:namespace-alias>.
The serialization method
The version of the serializer
The encoding to use, if possible
Do not output the <?xml ...?> declaration
Identify the result as a standalone document (in the XML sense)
The public identifier to use on the output <!DOCTYPE> declaration
The system identifier to use on the output <!DOCTYPE> declaration
A list of element names; the content of these element should be escaped with CDATA sections if possible
Add additional space to the serialized result tree for readability
The media type of the serialized result