Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax Free Open Book

Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax

Previous Section Next Section

Summary

XSLT is a template-driven environment for defining transformations between one XML document format and another. An XSLT stylesheet contains template rules that are matched against nodes in the input document. When a match is detected, the rule's template is instantiated and the result is added to the result tree. XSLT is itself an XML application that contains numerous elements for specifying exactly which nodes are matched when and what output is generated as a result.

XSLT is also a Turing-complete, functional programming language. Templates can be called by name and can be called recursively. Parameters can be passed to templates. XSLT is not as convenient to program in as traditional languages such as Java, but in its problem domain this approach works extremely well.

TrAX is a standard API for XSLT processors that is part of Java 1.4 and later and is bundled with most current XSLT processors for Java, including Saxon, Xalan, and jd.xslt. TrAX follows the abstract-factory design pattern. A TransformerFactory object creates Transformer objects from stylesheets. The Transformer objects transform XML documents in a variety of representations according to the instructions in their stylesheets. Both XSLT stylesheets and input XML documents are initially wrapped by a Source object. The target for output is wrapped by a Result object. TrAX includes a number of standard source and result implementations for different models, including SAX, DOM, and streams.

In addition to integrating XSLT into your Java programs, you can integrate Java into your XSLT stylesheets through extension elements and functions. The extension-element-prefixes attribute specifies which namespace prefixes are mapped to extension elements. The namespace URIs are used to find the necessary .class files in the processor's class path. The element-available() and function-available() functions and the xsl:fallback element test for the presence of extension functions and elements, enabling you to write portable stylesheets that work with or without the extensions. Once you've set this up, you can use the extension elements and functions just like standard XSLT elements and functions.

    Previous Section Next Section


         Main Menu
    Main Page
    Table of content
    Copyright
    Praise for Elliotte Rusty Harold's 'Processing XML with Java™'
    List of Examples
    List of Figures
    Preface
    Part I: XML
    Part II: SAX
    Part III: DOM
    Part IV: JDOM
    Part V: XPath/XSLT
    Chapter 16. XPath
    Chapter 17. XSLT
    XSL Transformations
    TrAX
    Extending XSLT with Java
    Summary
    Part VI: Appendixes


    More Books
    PHP Hacks
    Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
    The Koran (Holy Qur'an)
    Macromedia Flash 8 Bible
    Search Engine Optimization for Dummies
    YouTube Traffic
    PHP 5 for Dummies
    Harry Potter and The Chamber of Secrets
    Harry Potter and the Sorcerer's Stone
    The Pilgrim's Progress
    Wireless Hacks
    Flash Hacks. 100 Industrial-Strength Tips & Tools
    PayPal Hacks. 100 Industrial-Strength Tips and Tools
    Amazon Hacks
    Pdf Hacks
    The Da Vinci Code
    Google Hacks
    The Holy Bible
    Windows XP For Dummies
    Harry Potter and the Half-Blood Prince
    Seo Book
    Upgrading and Repairing Networks
    Macromedia Dreamweaver 8 UNLEASHED
    Windows XP Annoyances
    Windows XP Hacks
    Microsoft Windows XP Power Toolkit
    Teach Yourself MS Office In 24Hours
    iPod & iTunes Missing Manual
    PC Hacks 100 Industrial-Strength Tips and Tools
    PC Overclocking, Optimization, and Tuning - 2th Edition
    PC Hardware In A Nutshell 3rd Edition
    PC Hardware in a Nutshell, 2nd Edition
    Upgrading and Repairing PCs
    Google for Dummies
    MySQL Cookbook
    Teach Yourself Macromedia Flash 8 In 24 Hours
    PHP CookBook
    Sams Teach Yourself JavaScript in 24 Hours
    PHP5 Manual
    Free Games Paper Airplanes
    500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele