Transforming XML Documents

Total Page:16

File Type:pdf, Size:1020Kb

Transforming XML Documents University of Dublin Trinity College Transforming XML Documents [email protected] [email protected] What is XSL? • XSL (eXtensible Stylesheet Language) consists of – A language for transforming XML documents – A language for specifying formatting properties • Based on existing style sheets languages – Document Style Semantics and Specification Language (DSSSL) – Cascading Style Sheets (CSS) • A style sheet language specifically for XML documents • Uses an XML syntax • XSL is a combination of three specifications – XML Path Language (XPath) – XSL Transformations (XSLT) – XSL-FO (Formatting Objects) More @ http://www.w3.org/Style/XSL/ What are XSL Transformations? • Language for transforming XML documents into other XML/other documents – More generally input can be any document as long as it is represented as tree • Uses a collection of templates (rules) to transform the source document • XPath is used to select the parts of a source document to transform • Rule-based (declarative) language for transformations • Server-side/client-side execution Why XSL Transformations? • Powerful transformation functionality • An XML document may be completely restructured – Add/remove elements and attributes, re-arrange and sort elements – E.g. into an SQL Create table/Insert script • Dynamic documents – XML to XML, XML to (x)HTML, XML to PDF • Multiple renderings • Good software support for transformations • Easy and fast prototyping possible XSLT versions • XSLT 1.0 (W3C recommendation since 1999) – defined in two documents: the XSLT 1.0 and XPath 1.0 specifications. • XSLT 2.0 (W3C recommendation since 2007) – defined in a set of eight documents: XSLT 2.0, XPath 2.0, XQuery 1.0 … – Major enhancement to the language • Support for XML Schema - nodes and variables can have basic and custom datatypes • Multiple output of documents • User-defined functions – Integration with XQuery XSLT Processing Model Style/Transform Sheet XML Result Doc Doc Transformation Process XSLT Processing Model • Different output formats – xml, html, text • Multiple inputs – via document() – <xsl:value-of select="document(‘test.xml')/photo/title"/> • Multiple outputs – <xsl:result-document> • Multiple Programs – via <xsl:include> – and <xsl:import> • <xsl:apply-imports> applies a template rule from an imported style sheet. Client-side Example • https://www.cs.tcd.ie/Owen.Conlan/php/xpat h/xml2xsl.html Nodes in a Tree Model Node Root Element Attribute Namespace Text Comment Processing Instruction Example Tree <firstname> John </firstname> <surname> Smith </surname> is generic root element Element Text firstname surname is generic Text Text John Smith Fundamental Notion of xslt:template • Elements in a template body classified as either data node or instruction • When the template is executed element – Data nodes get copied to the result tree firstname – Instructions are executed Pattern to match <firstname> John </firstname> Text John <xsl:template match=“firstname"> <h2> <xsl:value-of select=“."/> </h2> Text Text Text </xsl:template> <h2> John </h2> Data nodes Instruction <h2> John </h2> Templates • Templates represent a set of rules • Rule matching is done within current context • Rule are not executed in order • Default Behaviour – always happens unless overwritten by specific rule • Matching Templates – <xsl:template match=‘...’ mode=‘...’> • Template instantiated for every element satisfying the match’s XPath expression • Named Templates – <xsl:template name=‘...’> • Template instantiated explicitly xsl:template <?xml version='1.0'?> XML Source XSLT <xsl:template match="/"> <grp id="G4"> </xsl:template> <p id="P3" sex="m"> <name>Mike</name> <xsl:template match="name"> <age>24</age> </xsl:template> </p> <p id="P7" sex="f"> <xsl:template match="//age"> </xsl:template> <name>Tanja</name> <age>21</age> <xsl:template match="p/name"> </p> </xsl:template> </grp> <xsl:template match="p[age='21']"> </xsl:template> <xsl:template match="p[@sex='f']"> </xsl:template> <xsl:template match= "name[ancestor::grp/@id='G4']"> </xsl:template> Built in Templates • XSLT provides default built-in template rules for each of the 7 kinds of nodes • If there is no template rule that matches the node, then the default rule is invoked root calls <xsl:apply-templates> to process its children element calls <xsl:apply-templates> to process its children attribute Copies the attribute value to the result tree text copies the text to the result tree comment do nothing process- do nothing instruction namespace do nothing Gaining control of the processing • Built in template rule for element node – <xsl:apply-templates/> – “select all children of the current node in the source tree and for each one find the matching template rule in the stylesheet and execute it” • Controlling the sequence of processing - Explicitly use instructions – With pattern match • <xsl:apply-templates/> • <xsl:apply-templates select=“some_pattern”> – With specific invocation • <xsl:call-template> to invoke a specific template by name rather than by pattern matching Template Modes • Modes are used to modify the rule set and context • Allow us to process the same node more than once, but in different way • Example – • <xsl:template match=‘...’ mode=‘...’> Conflict Resolution Policy • What if more than one template rule whose pattern matches particular node? • Conflict can be resolved… – By assigned priority through template definition or system allocation. A higher value indicates priority – Current stylesheet rules take precedence over imported stylesheet rules – Precedency is given to more specific rules – In the case where same import precedence and same priorities… down to the way the XSLT engine is implemented! XSLT Elements 1. xsl:stylesheet 13.xsl:variable 2. xsl:transform 14.xsl:param 3. xsl:output 15.xsl:with-param 4. xsl:template 16.xsl:if 5. xsl:apply-templates 17.xsl:choose 6. xsl:call-template 18.xsl:when 7. xsl:text 19.xsl:otherwise 8. xsl:value-of 20.xsl:for-each 9. xsl:copy-of 10.xsl:element 11.xsl:attribute 12.xsl:sort xsl:transform, xsl:stylesheet <?xml version="1.0"?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> [...] </xsl:transform> <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> [...] </xsl:stylesheet> xsl:output <?xml version="1.0"?> <?xml version="1.0"?> <xsl:stylesheet <xsl:stylesheet version="1.0" version="1.0" xmlns:xsl="http://www.w3.org xmlns:xsl="http://www.w3.org /1999/XSL/Transform"> /1999/XSL/Transform"> <xsl:output <xsl:output method="html" method="xml"/> indent="yes"/> [...] [...] </xsl:stylesheet> </xsl:stylesheet> xsl:apply-templates <?xml version='1.0'?> XML Source <xsl:template match="/"> XSLT <grp id="G4"> <xsl:apply-templates select="grp"/> <p id="P3" sex="m"> </xsl:template> <name>Mike</name> <age>24</age> </p> <xsl:template match="grp"> <p id="P7" sex="f"> <xsl:apply-templates select="p"/> <name>Tanja</name> </xsl:template> <age>21</age> </p> <xsl:template match="p"> </grp> <xsl:apply-templates /> </xsl:template> <xsl:template match="name"> </xsl:template> <xsl:template match="age"> </xsl:template> xsl:call-template <?xml version='1.0'?> XML Source <xsl:template match="grp"> XSLT <div> <grp id="G4"> <xsl:apply-templates /> <p id="P3" sex="m"> </div> <name>Mike</name> </xsl:template> <age>24</age> <xsl:template match="p"> </p> <dt> <p id="P7" sex="f"> <xsl:value-of select="name" /> <name>Tanja</name> </dt> <age>21</age> <dd> <xsl:value-of select="age" /> </p> <xsl:call-template name="d" /> </grp> </dd> </xsl:template> <dl> Result <dt>Mike</dt> <xsl:template name="d"> <dd>24 (more than 8760 days)</dd> <xsl:text>(more than </xsl:text> <dt>Tanja</dt> <xsl:value-of <dd>24 (more than 7665 days)</dd> select="365*number(age)" /> </dl> <xsl:text> days)</xsl:text> </xsl:template> Result Tree Creation • Generate the output file • Literals (data nodes) - e.g <p>, <li>, </p>, </li> • <xsl:text> - send content directly to output (retain whitespaces) • <xsl:value-of> - extract element values (anywhere in the tree) • <xsl:copy-of> - deep copy selected nodes • <xsl:copy> - shallow copy selected nodes • <xsl:element> - instantiate an element • <xsl:attribute> - instantiate an attribute • <xsl:comment> - instantiate a comment • <xsl:processing-instruction>-instantiate an instruction xsl:text & text() <?xml version='1.0'?> XML Source <xsl:template match="/"> XSLT <grp id="G4"> <xsl:apply-templates select="grp"/> <p id="P3" sex="m"> </xsl:template> <name>Mike</name> <age>24</age> <xsl:template match="grp"> </p> <ul> <p id="P7" sex="f"> <xsl:apply-templates <name>Tanja</name> select="p/name"/> <age>21</age> </ul> </p> </xsl:template> </grp> <xsl:template match="name"> <ul> Result <li> <li>Name: Mike</li> <xsl:text>Name: </xsl:text> <li>Name: Tanja</li> </ul> <xsl:apply-templates /> </li> </xsl:template> <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template> © 2003 B. Jung xsl:value-of <?xml version='1.0'?> XML Source <xsl:template match="/"> XSLT <grp id="G4"> <xsl:apply-templates select="grp"/> <p id="P3" sex="m"> </xsl:template> <name>Mike</name> <age>24</age> <xsl:template match="grp"> </p> <ul> <p id="P7" sex="f"> <xsl:apply-templates <name>Tanja</name> select="p"/> <age>21</age> </ul> </p> </xsl:template> </grp> <xsl:template match="p"> <li> <ul> Result <xsl:value-of select="name"/> <li>Mike 24</li> <li>Tanja 21</li> <xsl:apply-templates </ul> select="age" /> </li> </xsl:template> <xsl:template match="age"> <xsl:value-of select="."/> </xsl:template> xsl:copy-of <?xml
Recommended publications
  • Presentation of XML Documents
    Presentation of XML Documents Patryk Czarnik Institute of Informatics University of Warsaw XML and Modern Techniques of Content Management – 2012/13 Stylesheets Separation of content and formatting Separating content and formatting According to XML best practices, documents should contain: “pure” content / data markup for structure and meaning (“semantic” or “descriptive” markup) no formatting How to present? “hard-coded” interpretation of known document types, e.g. Libre Office rendering Writer document importing or pasting content into word processor or DTP tool and manual or automatic formatting, e.g. Adobe InDesign approach external style sheets Patryk Czarnik 05 – Presentation XML 2012/13 4 / 1 Idea of stylesheet <person id="102103" position="specialist"><person id="102105" position="assistant"> <first-name>Dawid</first-name> <first-name>Arkadiusz</first-name> <last-name>Paszkiewicz</last-name> <last-name>Gierasimczyk</last-name> <phone type="office">+48223213203</phone> <phone type="office">+48223213213</phone> <phone type="fax">+48223213200</phone> <phone type="mobile">+48501502503</phone> <email>[email protected]</email> <email>[email protected]</email> </person> </person> * font 'Times 10pt' * yellow backgorund * 12pt for name * blue font and border * abbreviation before * italic font for name phone number * typewritter font for email Stylesheets Separation of content and formatting Benefits of content and formatting separation General advantages of descriptive markup better content understanding and easier analysis Ability to present in the same way: the same document after modification another document of the same structure Formatting managed in one place easy to change style of whole class of documents Ability to define many stylesheets for a document class, depending on purpose and expectations: medium (screen / paper / voice) expected number of details (full report / summary) reader preferences (font size, colors, .
    [Show full text]
  • Stylesheet Translations of SVG to VML
    Stylesheet Translations of SVG to VML A Master's Project presented to The Faculty of the Department of Computer Science San Jose State University In Partial Fulfillment of the Requirements for the Degree of Master of Science Julie Nabong Advisor: Dr. Chris Pollett May 2004 Abstract The most common graphics formats on the Web today are JPEG and GIF. In addition to these formats, two XML-based graphic types are available as open standards: SVG and VML. SVG and VML are vector graphic formats. These formats offer benefits such as fast Web download time, zoomable images, and searchable texts. Because these vector graphics are scalable, these images can be viewed in different screen sizes, such as PC displays and handheld devices. SVG and VML implementations are gaining popularity in Internet cartography and zoomable charts. SVG images can be viewed by downloading a plug-in; whereas, VML images are rendered in Microsoft's Internet Explorer browser versions 5.0 and higher. Although SVG may be considered a more mature format than VML, it is unlikely it will be supported natively by Microsoft anytime soon. In this master's project, SVG images will be transformed into VML images contained in an HTML document that can be viewed without a plug-in. SVG images will be manipulated through the Document Object Model API and transformed into VML images using JavaScript, XSLT, and XPath. JavaScript will play an important role in handling functionalities not present in XSLT. This project will address the issue of gradient discrepancies between the two formats, and try to get the speed of the translation as close to that of the plug-in based solution as possible.
    [Show full text]
  • Refactoring XSLT
    XSLT and XQuery September 19, 2019 Refactoring XSLT Priscilla Walmsley, Datypic, Inc. Class Outline Introduction ......................................................................................................................................2 Cleaning Up......................................................................................................................................9 Improving Code Quality..................................................................................................................14 Other Improvements.......................................................................................................................21 Introduction 2 Obligatory Wikipedia Quote 3 Code refactoring is the process of restructuring existing computer code - changing the factoring - without changing its external behavior. Refactoring improves nonfunctional attributes of the software. Advantages include improved code readability and reduced complexity; these can improve source code maintainability and create a more expressive internal architecture or object model to improve extensibility. Typically, refactoring applies a series of standardised basic micro-refactorings, each of which is (usually) a tiny change in a computer program's source code that either preserves the behaviour of the software, or at least does not modify its conformance to functional requirements. Many development environments provide automated support for performing the mechanical aspects of these basic refactorings. If done extremely well, code
    [Show full text]
  • XML: Looking at the Forest Instead of the Trees Guy Lapalme Professor Département D©Informatique Et De Recherche Opérationnelle Université De Montréal
    XML: Looking at the Forest Instead of the Trees Guy Lapalme Professor Département d©informatique et de recherche opérationnelle Université de Montréal C.P. 6128, Succ. Centre-Ville Montréal, Québec Canada H3C 3J7 [email protected] http://www.iro.umontreal.ca/~lapalme/ForestInsteadOfTheTrees/ Publication date April 14, 2019 XML to PDF by RenderX XEP XSL-FO Formatter, visit us at http://www.renderx.com/ XML: Looking at the Forest Instead of the Trees Guy Lapalme Professor Département d©informatique et de recherche opérationnelle Université de Montréal C.P. 6128, Succ. Centre-Ville Montréal, Québec Canada H3C 3J7 [email protected] http://www.iro.umontreal.ca/~lapalme/ForestInsteadOfTheTrees/ Publication date April 14, 2019 Abstract This tutorial gives a high-level overview of the main principles underlying some XML technologies: DTD, XML Schema, RELAX NG, Schematron, XPath, XSL stylesheets, Formatting Objects, DOM, SAX and StAX models of processing. They are presented from the point of view of the computer scientist, without the hype too often associated with them. We do not give a detailed description but we focus on the relations between the main ideas of XML and other computer language technologies. A single compact pretty-print example is used throughout the text to illustrate the processing of an XML structure with XML technologies or with Java programs. We also show how to create an XML document by programming in Java, in Ruby, in Python, in PHP, in E4X (Ecmascript for XML) and in Swift. The source code of the example XML ®les and the programs are available either at the companion web site of this document or by clicking on the ®le name within brackets at the start of the caption of each example.
    [Show full text]
  • SVG-Based Knowledge Visualization
    MASARYK UNIVERSITY FACULTY}w¡¢£¤¥¦§¨ OF I !"#$%&'()+,-./012345<yA|NFORMATICS SVG-based Knowledge Visualization DIPLOMA THESIS Miloš Kaláb Brno, spring 2012 Declaration Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Advisor: RNDr. Tomáš Gregar Ph.D. ii Acknowledgement I would like to thank RNDr. Tomáš Gregar Ph.D. for supervising the thesis. His opinions, comments and advising helped me a lot with accomplishing this work. I would also like to thank to Dr. Daniel Sonntag from DFKI GmbH. Saarbrücken, Germany, for the opportunity to work for him on the Medico project and for his supervising of the thesis during my erasmus exchange in Germany. Big thanks also to Jochen Setz from Dr. Sonntag’s team who worked on the server background used by my visualization. Last but not least, I would like to thank to my family and friends for being extraordinary supportive. iii Abstract The aim of this thesis is to analyze the visualization of semantic data and sug- gest an approach to general visualization into the SVG format. Afterwards, the approach is to be implemented in a visualizer allowing user to customize the visualization according to the nature of the data. The visualizer was integrated as an extension of Fresnel Editor. iv Keywords Semantic knowledge, SVG, Visualization, JavaScript, Java, XML, Fresnel, XSLT v Contents Introduction . .3 1 Brief Introduction to the Related Technologies ..........5 1.1 XML – Extensible Markup Language ..............5 1.1.1 XSLT – Extensible Stylesheet Lang.
    [Show full text]
  • Spreadsheet-Based Complex Data Transformation
    Spreadsheet-based complex data transformation Hung Thanh Vu Dissertation submitted in fulfilment of the requirements for the degree of Doctor of Philosophy School of Computer Science and Engineering University of New South Wales Sydney, NSW 2052, Australia March 2011 Supervisor: Prof. Boualem Benatallah i Acknowledgements I am very grateful to Professor Boualem for his exceptional unconditional support and limitless patience. He was the first person who taught me how to do research; how to write and present a complex research problem. He has always been there for me when I have any difficulties in research. He is one of the best supervisors I have ever worked with. Without his support, this thesis would never be completed. My sincere thanks go to Dr Regis Saint-Paul for his fruitful collaborations and providing me invaluable research skills. I also wish to express my gratitude to the members of the SOC group, who spent a lot of time discussing with me on the research issues and giving me helpful advice. I would like to thank Dr Paolo Papotti for insightful discussions on data exchange as well as mapping tools Clio, Clip, and +Spicy; Assisstant Professor Christopher Scaffidi for answering my questions on Topes; Associate Professor Wang-Chiew Tan and Dr Bogdan Alexe for helping me understand STBenchmark; Dr Wei Wang for helpful discussions on similarity join and its related algorithms; and some members of XQuery WG and XSLT WG including Daniela Florescu, Jerome Simeon, and Michael Kay for giving me advice on the expressiveness and new updates of XSLT and XQuery. Last but not least, I am forever in debt to my parents.
    [Show full text]
  • Create an HTML Output from Your Own Project with XSLT
    Create an HTML output from your own project with XSLT Martina Semlak - Georg Vogeler IDE Spring School 2015, Graz Folie 2 IDE Spring School 2015, Graz Minimal stuff provided <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0"> <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" /> </xsl:stylesheet> Folie 3 IDE Spring School 2015, Graz First step Grab file xsl:template with the attribute: match="/" This template can contain the basic HTML structure of the ouput file Folie 4 IDE Spring School 2015, Graz HTML basics – Reminder <html> <head><title></title><link (e.g. for a css)></head> <body></body> </html> We added this into <xsl:template match="/"> </xsl:template> Folie 5 IDE Spring School 2015, Graz Display text We have prepared basic HTML structure for you: header, section, nav > ul = navigation with references to other files We need a heading for the whole text: html: section > h3 xsl: xsl:value-of, attribute select with the appropriate xpath: //body/head div seems to be convenient to retain: do something with all divs: <xsl:apply-templates select="//body/div"/> what to do: <xsl:template match="div"> <div><xsl:apply-templates /></div> </xsl:template> Folie 6 IDE Spring School 2015, Graz XPath conditions Use a condition in the XPath (square brackets) for html: body/header > h1 and h2: find the appropriate title-element with type main or sub <h1> <xsl:value-of select="//title[@type='main']"/> </h1> Folie 7 IDE Spring School 2015, Graz <apply-templates />: individual templates xsl:template match="lg" div class="stanza" xsl:template match="l" <br/>..
    [Show full text]
  • Release Notes for the Docbook XSL Stylesheets I
    Release Notes for the DocBook XSL Stylesheets i Release Notes for the DocBook XSL Stylesheets Release Notes for the DocBook XSL Stylesheets ii Contents 1 Release Notes: snapshot 1 2 Release Notes: 1.79.2 1 3 Release Notes: 1.79.1 1 3.1 Gentext . .1 3.2 Common . .2 3.3 FO...........................................................4 3.4 HTML.........................................................9 3.5 Manpages . 13 3.6 Epub.......................................................... 14 3.7 HTMLHelp . 16 3.8 Eclipse . 16 3.9 JavaHelp . 16 3.10 Slides . 17 3.11 Website . 17 3.12 Webhelp . 18 3.13 Params . 18 3.14 Profiling . 20 3.15Lib........................................................... 20 3.16 Tools . 20 3.17 Template . 21 3.18 Extensions . 21 4 Release Notes: 1.79.0 21 4.1 Gentext . 22 4.2 Common . 23 4.3 FO........................................................... 24 4.4 HTML......................................................... 29 4.5 Manpages . 34 4.6 Epub.......................................................... 35 4.7 HTMLHelp . 36 4.8 Eclipse . 36 4.9 JavaHelp . 37 4.10 Slides . 37 4.11 Website . 38 4.12 Webhelp . 38 4.13 Params . 39 Release Notes for the DocBook XSL Stylesheets iii 4.14 Profiling . 40 4.15Lib........................................................... 40 4.16 Tools . 40 4.17 Template . 41 4.18 Extensions . 42 5 Release Notes: 1.78.1 42 5.1 Common . 42 5.2 FO........................................................... 43 5.3 HTML......................................................... 43 5.4 Manpages . 44 5.5 Webhelp . 44 5.6 Params . 44 5.7 Highlighting . 44 6 Release Notes: 1.78.0 44 6.1 Gentext . 45 6.2 Common . 45 6.3 FO........................................................... 46 6.4 HTML......................................................... 47 6.5 Manpages .
    [Show full text]
  • XSL-FO by Dave Pawson Publisher
    XSL-FO By Dave Pawson Publisher : O'Reilly Pub Date : August 2002 ISBN : 0-596-00355-2 Pages : 282 Table of • Contents • Index • Reviews Reader • Reviews Extensible Style Language-Formatting Objects, or XSL-FO, is a set of tools developers and web designers use to describe page printouts of their XML (including XHTML) documents. XSL-FO teaches you how to think about the formatting of your documents and guides you through the questions you'll need to ask to ensure that your printed documents meet the same high standards as your computer-generated content. 777 Copyright Preface Who Should Read This Book? What Does This Book Cover? Motivation Organization of This Book What Else Do You Need? Conventions Used in This Book How to Contact Us Acknowledgments Chapter 1. Planning for XSL-FO Section 1.1. XML and Document Processing Section 1.2. Choosing Your Print Production Approach Section 1.3. Choosing Tools Section 1.4. The Future for XSL-FO Chapter 2. A First Look at XSL-FO Section 2.1. An XSL-FO Overview Section 2.2. Related Stylesheet Specifications Section 2.3. Using XSL-FO as Part of XSL Section 2.4. Shorthand, Short Form, and Inheritance Chapter 3. Pagination Section 3.1. Document Classes Section 3.2. The Main Parts of an XSL-FO Document Section 3.3. Simple Page Master Section 3.4. Complex Pagination Section 3.5. Page Sequences Chapter 4. Areas Section 4.1. Informal Definition of an Area Section 4.2. Area Types Section 4.3. Components of an Area Section 4.4.
    [Show full text]
  • Using XSL and Mod Transform in Apache Applications
    Using XSL and mod_transform in Apache Applications Paul Querna [email protected] What is XSL? ● Extensible Stylesheet Language (XSL) ● A family of Standards for XML by the W3C: – XSL Transformations (XSLT) – XML Path Language (Xpath) – XSL Formatting Objects (XSL-FO) XSLT Example <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html> <head><title>A Message</title></head> <body> <h1> <xsl:value-of select="message" /> </h1> </body> </html> </xsl:template> </xsl:stylesheet> Data Source... <?xml version="1.0"?> <message>Hello World</message> Outputs... <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>A Message</title> </head> <body> <h1>Hello World</h1> </body> </html> Why is XSLT good? ● Mixing Data and Presentation is bad! – Keeps Data in a clean XML schema – Keeps the Presentation of this Data separate ● XSLT is XML ● Easy to Extend ● Put HTML or other Markups directly in the XSLT. – Easy for Web Developers to create a template Why is XSLT bad? ● XSLT is XML ● Complicated XSLT can be slow ● Yet another language to learn Where does Apache fit in this? ● Apache 2.0 has Filters! Input Handlers Client Filters (Perl, PHP, Proxy, File) Output Filters mod_include (SSI) mod_transform (XSLT) mod_deflate (gzip) mod_transform ● Uses libXML2 and libXSLT from Gnome – C API ● Doesn't depend on other Gnome Libs. – Provides: ● EXSLT ● XInclude ● XPath ● Xpointer ● ... and more Static XML Files ● AddOutputFilter XSLT .xml ● TransformSet /xsl/foo.xsl – Only if your XML does not specify a XSL File ● TransformOptions +ApacheFS – Uses Sub-Requests to find files – Makes mod_transform work like Apache AxKit Dynamic Sources ● XML Content Types: – AddOutputFilterByType XSLT application/xml ● Controlled Content Types: – AddOutputFilterByType XSLT applicain/needs- xslt ● Works for Proxied Content, PHP, mod_perl, mod_python, CGI, SSI, etc.
    [Show full text]
  • Synchronized Multimedia Integration Language (SMIL) Boston Specification
    Synchronized Multimedia Integration Language (SMIL) Boston Specification Synchronized Multimedia Integration Language (SMIL) Boston Specification W3C Working Draft 15 November 1999 This version: http://www.w3.org/TR/1999/WD-smil-boston-19991115 Latest version: http://www.w3.org/TR/smil-boston Previous version: http://www.w3.org/1999/08/WD-smil-boston-19990820 Editors: Jeff Ayars (RealNetworks), Aaron Cohen (Intel), Ken Day (Macromedia), Erik Hodge (RealNetworks), Philipp Hoschka (W3C), Rob Lanphier (RealNetworks), Nabil Layaïda (INRIA), Jacco van Ossenbruggen (CWI), Lloyd Rutledge (CWI), Bridie Saccocio (RealNetworks), Patrick Schmitz (Microsoft), Warner ten Kate (Philips), Ted Wugofski (Gateway), Jin Yu (Compaq), Thierry Michel (W3C). Copyright © 1999 W3C ® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Abstract This document specifies the "Boston" version of the Synchronized Multimedia Integration Language (SMIL, pronounced "smile"). SMIL Boston has the following two design goals: Define a simple XML-based language that allows authors to write interactive multimedia presentations. Using SMIL Boston, an author can describe the temporal behavior of a multimedia presentation, associate hyperlinks with media objects and describe the layout of the presentation on a screen. Allow reusing of SMIL syntax and semantics in other XML-based languages, in particular those who need to represent timing and synchronization. For example, SMIL Boston components should be used for integrating timing into XHTML [XHTML10]. Status of this document This section describes the status of this document at the time of its publication. Other documents may supersede this document. The latest status of this document series is maintained at the W3C. 1 Available formats This document is the second working draft of the specification for the next version of SMIL code-named "Boston".
    [Show full text]
  • Beginning XSLT for Humanists
    Beginning&XSLT&for&Humanists& April&18920,&2013& Beginning XSLT for Humanists SOUTHEASTERN LOUISIANA UNIVERSITY APRIL 18-20 http://idhmc.tamu.edu/xslt4u Introduction ! Matthew Christy ! [email protected] ! Lead Software Applications Developer ! Initiative for Digital Humanities, Media, and Culture (IDHMC) – Texas A&M University " We are available for help and consultations with XSLT work " XSLT workshops " Visualization Lab " Contact Director Laura Mandel ([email protected]) ! Class introductions ! Name & Department ! Current / planned projects SELU - Beginning XSLT - XSLT April 18-20, 2013 1& Beginning&XSLT&for&Humanists& April&18920,&2013& ! Day 1 ! HTML Outline ! CSS Day 1 ! Oxygen Editor Day 2 ! XML Day 3 SELU - Beginning XSLT - XSLT April 18-20, 2013 ! Day 2 ! XSLT • What is XSLT? Outline • Tree Structure • What is XSLT for? Day 1 • XPath Exercises • Versions • Flow Control Day 2 • XSLT is XML • Output Control • The Identity Day 3 • Whitespace Template • Variables & • Applying XSLT to Parameters XML • Sort • Basic Elements • Planning • Context • XSLT Exercises • XPath SELU - Beginning XSLT - XSLT April 18-20, 2013 2& Beginning&XSLT&for&Humanists& April&18920,&2013& ! Day 3 ! TEI Outline " What is TEI? Day 1 " What is TEI for? Day 2 " Versions " Reference Materials Day 3 " Structure " TEI Stylesheets " Modifying TEI Stylesheets " Exercises SELU - Beginning XSLT - XSLT April 18-20, 2013 Beginning XSLT for Humanists HTML HTML • What is HTML? • Markup • Versions • Flavors • The Good, the Bad, the Ugly SELU - Beginning XSLT - XSLT April 18-20, 2013 3& Beginning&XSLT&for&Humanists& April&18920,&2013& What is HTML? ! Hyper Text Markup Language " Hypertext: text displayed on a computer with references (hyperlinks) to that provide access to other texts.
    [Show full text]