Intoduction
XSL components
Examples
Pattern Syntax
Recursion
Templates
Sorting
Basic properties
Advanced Topics


Free Tutorials
Internet
What is Internet
Internet Games
Learn TCP IP
HTML
Learn HTML
Learn DHTML
Learn CSS
Learn XML
Learn XHTML
Learn XSL
Learn WML
Database
Learn Access
Learn Data-VB
Learn Oracle
Learn SQL
Programming
Learn ActiveX
Learn C++
Learn CGI_Perl
Learn Interdev
Learn Java
Learn JavaScript
Learn Vbscript
Learn VisualBasic
Learn VC++
Operating systems
Learn RedHat
Learn Unix
Learn Winnt

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





|  About us | Categories | New Releases | Most Popular | Web Tutorial | Free Download | Drivers |



2013 Soft Lookup Corp. Privacy Statement