1 / 14

Extensible Stylesheet Language (XSL)

Extensible Stylesheet Language (XSL). Brian Temple. about:XSL. XSL is a language for expressing stylesheets a language for transforming XML documents an XML vocabulary for specifying formatting semantics. But, why XSL?. Unlike HTML, XML element names have no intrinsic presentation semantics

Télécharger la présentation

Extensible Stylesheet Language (XSL)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Extensible Stylesheet Language(XSL) Brian Temple

  2. about:XSL • XSL is a language for expressing stylesheets • a language for transforming XML documents • an XML vocabulary for specifying formatting semantics

  3. But, why XSL? • Unlike HTML, XML element names have no intrinsic presentation semantics • Builds on prior work of CSS2, DSSSL • Can be extended

  4. <?xml version=“1.0”?> <purchaseOrder orderDate=“1999-10-20”> <shipTo country=“US”> <name>Matthias Hauswirth</name> <street>4500 Brookfield Dr.</street> <city>Boulder</city> <state>CO</state> <zip>80303</zip> </shipTo> <billTo country=“US”> <name>Brian Temple</name> <street>1234 Strasse</street> <city>Boulder</city> <state>CO</state> <zip>80302</zip> </billTo> <comment>Brian pays</comment> <items> <item partNum=“123-AB”> <productName>Porsche</productName> <quantity>1</quantity> <price>129400.00</price> <comment>Need a new one</comment> </item> <item> <productName>Ferrari</productName> <quantity>2</quantity> <price>189000.25</price> <shipDate>1999-05-21</shipDate> </item> </items> </purchaseOrder> An Example XML Document

  5. Simple XSL Document <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <HTML> <BODY> <table border="2" bgcolor="yellow"> <xsl:for-each select="records/purchaseOrder"> <tr> <td><xsl:value-of select="shipTo/name"/></td> <td><xsl:value-of select="comment"/></td> <xsl:for-each select="items/item"> <td><xsl:value-of select="price"/></td> </xsl:for-each> </tr> </xsl:for-each> </table> </BODY> </HTML> </xsl:template> </xsl:stylesheet>

  6. Simple XSL Results

  7. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <HTML> <BODY> <table border="2" bgcolor="yellow"> <xsl:for-each select="records/purchaseOrder"> <tr> <td><xsl:value-of select="shipTo/name"/></td> <td><xsl:value-of select="comment"/></td> <xsl:for-each select="items/item"> <xsl:choose> <xsl:when match=".[price>100]"> <td bgcolor="red"><xsl:value-of select="price"/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="price"/></td> </xsl:otherwise> </xsl:choose> </xsl:for-each> </tr> </xsl:for-each> </table> </BODY> </HTML> </xsl:template> </xsl:stylesheet> XSL:CHOOSE

  8. XSL:CHOOSE Results

  9. Processing a stylesheet

  10. Formatting process • Build formatting object tree • Produce refined formatting object tree • mapping from properties to traits • shorthand expansion into individual properties • mapping of corresponding properties • determining computed values • inheritance • Construct area tree

  11. The Area Model

  12. A Typical Area Tree

  13. <doc> <p>This is an <emph>important word</emph> in this sentence that also refers to a <code>variable</code>.</p> </doc> <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'> ... <xsl:template match="code"> <fo:wrapper font-family="Courier"> <xsl:apply-templates/> </fo:wrapper> </xsl:template> Fe FiFOFum

  14. bidi-override block block-container character color-profile conditional-page-master-reference declarations external-graphic float flow footnote footnote-body initial-property-set inline inline-container instream-foreign-object layout-master-set leader list-block list-item list-item-body list-item-label marker multi-case multi-properties multi-property-set multi-switch multi-toggle page-number page-number-citation page-sequence page-sequence-master region-after region-before region-body region-end region-start repeatable-page-master-alternatives repeatable-page-master-reference retrieve-marker root simple-link simple-page-master single-page-master-reference Examples of Formatting Objects • static-content • table • table-and-caption • table-body • table-caption • table-cell • table-column • table-footer • table-header • table-row • title • wrapper

More Related