Web based School

Basic properties


Next Next


Basic properties

  • font properties

  • margin and spacing properties

  • border and padding properties

  • keeps/breaks

  • horizontal alignment/justification

  • indentation

  • more formatting object specific properties

Overall XSL formatting capabilities

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)

Chapter, title, para example

<?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>

Modularizing Stylesheets

<xsl:include>

Performs a roughly textual include of the referenced stylesheet

<xsl:import>

The importing stylesheet "extends" the imported stylesheet

Controlling Output Serialization

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>.

<xsl:output>

<xsl:output method = "xml" | "html" | "text" | qname-but-not-ncname version = nmtoken encoding = string omit-xml-declaration = "yes" | "no" standalone = "yes" | "no" doctype-public = string doctype-system = string cdata-section-elements = qnames indent = "yes" | "no" media-type = string />
method

The serialization method

version

The version of the serializer

encoding

The encoding to use, if possible

omit-xml-declaration

Do not output the <?xml ...?> declaration

standalone

Identify the result as a standalone document (in the XML sense)

doctype-public

The public identifier to use on the output <!DOCTYPE> declaration

doctype-system

The system identifier to use on the output <!DOCTYPE> declaration

cdata-section-elements

A list of element names; the content of these element should be escaped with CDATA sections if possible

indent

Add additional space to the serialized result tree for readability

media-type

The media type of the serialized result





Next Next