XML
  Home arrow XML arrow Page 5 - An Introduction to XSLT
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

An Introduction to XSLT
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    2004-09-20

    Table of Contents:
  • An Introduction to XSLT
  • Create Elements to Apply the Transformations
  • Another Template
  • Discussion of the Output
  • Page Masters
  • Block Level Elements

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    An Introduction to XSLT - Page Masters


    (Page 5 of 6 )


     
    In addition to this, there is the Formatting-Objects language, XSL (formerly know as XSL-FO) that we have not yet explored. These are reserved XML elements that are defined in the FO namespace. XSL documents contain an fo:root element which acts as the document root:

    <fo:root xmlns:fo="http://www.w3.org/XSL/Format">
    </fo:root>

    This document root then contains a layout element that defines the page layout (known as page masters):

    <fo:layout-master-set>
    </fo:layout-master-set>

    Nested within the layout-master are the page master elements:

    <fo:simple-page-master page-master-name="Intro">
    </fo:simple-page-master>

    The page master element can be used to set the size of the outputted document using the following syntax:

    <fo:simple-page-master page-master-name="Intro" height="10.0in"

    width="8.0in">
    </fo:simple-page-master>

    If these values are omitted, the processor will assign pre-defined values depending on the media the outputted document is displayed to. The page-master element can also be used to set page margins:

    <fo:simple-page-master page-master-name="Intro" height="10.00in"

    width="8.00in" margin-top="1.0in"
    margin-bottom="1.0in" margin-left="1.0in" margin-right="1.0">
    </fo:simple-page-master>
     
    XSL-FO documents position content on a page according to the following hierarchy of areas:

    • Pages
    • Regions
    • Block Areas
    • Line Areas
    • Inline Areas

    Area Containers contain either additional Area Containers or Block Areas. Block Areas contain either additional Block Areas or Line Areas. Area containers define the basic structure in which your XML is displayed. Block Areas are used to define paragraphs and lists, and they can contain text. Line Areas contain Inline Areas and Inline Spaces.  Line Areas are used to contain elements for graphics, mathematical equations or links.  Inline Areas are rectangular areas used to format and contain content such as graphics, text and horizontal rules. The page-masters that we examined a moment ago are constructed using area containers in the following way:

    <fo:region-start extent="0.5in"/> Left edge of the page
    <fo:region-before extent="0.5in"/> Top edge of the page
    <fo:region-body/>   Main body of the page
    <fo:region-end extent="0.5in"/>  Right edge of the page
    <fo:region-after extent="0.5in"/> Bottom edge of the page

    These region elements also have attributes to set properties, including:

    • Borders
    • Background
    • Padding
    • Margins
    • Overflow
    • Columns
    • Text orientation and direction

    Page-masters can be applied to the content of your document using the page-sequence element:

    <fo:page-squence>
    </fo:page-sequence>

    This element can then contain a further two elements:

    <fo:static content>
    <fo:flow>

    The static content element is optional and can be used to display content that appears on every page in a sequence, such as headings.  The fo:flow element contains a list of the elements that appear in your document, in the order in which they appear. 

    If your page is not big enough to contain all of the elements, additional pages are created.  This is how the overflow of elements is handled as fo:static elements cannot overflow.

    More XML Articles
    More By Dan Wellman


       · What is it with XML authors that can't use basic HTML correctly?Mixed case HTML...
       · excellent point, i know what you mean by this valid stuff...i see it from many...
       · Hi,Yes Dev ur right. It happens when u program it without going through its...
     

    XML ARTICLES

    - Using Regions with XSL Formatting Objects
    - Using XSL Formatting Objects
    - More Schematron Features
    - Schematron Patterns and Validation
    - Using Schematron
    - Datatypes and More in RELAX NG
    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek