XML
  Home arrow XML arrow Page 6 - 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 
Sun Developer Network 
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 / 11
    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 - Block Level Elements


    (Page 6 of 6 )

    Content is organized in the stylesheet as descendants of either the fo:flow or fo:static content elements, and appear in the resulting document as block level containers, rectangular areas preceded and followed by line breaks.  Example of block-level elements include:

    - fo:block
    - fo:list
    - fo:list-item

    The basic syntax of block-level elements is as follows:

    <fo:flow>
        <fo:block>
            <xsl:apply-templates select="article"/>
        </fo:block>
    </fo:flow>

    Think of these block-level containers as the same as the <div> tag in HTML.  The block-level containers all have a similar set of properties with which you can control how they appear in the resulting document; there are font properties, margin and padding properties, alignments, columns, backgrounds and borders. They are set in the following way:

    <fo:block font-size="12pt">

    An example of an extremely basic XSL (XSL-FO) document is:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <fo:root xmlns:fo="
    http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
          <fo:simple-page-master master-name="mypage">
          </fo:simple-page-master>
       </fo:layout-master-set>
       <fo:page-sequence master-reference="mypage">
           <fo:flow flow-name="xsl-region-body">
               <fo:block>DevShed Rocks!</fo:block>
           </fo:flow>
       </fo:page-sequence>
    </fo:root>

    Save this file as formatting.xml in the same directory as news.xml, then in news.xml, change the stylesheet href to:

    <?xml-stylesheet type="text/xsl" href="formatting.xml"?>
     
    Save this file again with the filename news3.xml. Now open news3.xml and it should simply say 'DevShed Rocks!' The original content of news.xml is not displayed, but as you can use XSLT to do this, it doesn't really matter. There are many properties and attributes that can be set to these elements, far too many to list them all here. I hope that I have given you enough information to make use of XSLT and to understand the basics of XSL (the formatting language).


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · 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

    - 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
    - UI Design with Java and XML Toolkits
    - Displaying ADO Retrieved Data with XML Islan...
    - Widget Walkthrough
    - Introduction to Widgets
    - The Why and How of XML Data Islands






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT