Extensible Stylesheet Language XSL - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Extensible Stylesheet Language XSL

Description:

table border='2' bgcolor='yellow' xsl:for-each select='records/purchaseOrder' tr ... td bgcolor='red' xsl:value-of select='price'/ /td /xsl:when xsl: ... – PowerPoint PPT presentation

Number of Views:100
Avg rating:3.0/5.0
Slides: 15
Provided by: tem987
Category:

less

Transcript and Presenter's Notes

Title: Extensible Stylesheet Language XSL


1
Extensible Stylesheet Language(XSL)
  • Brian Temple

2
aboutXSL
  • 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
An Example XML Document
  • lt?xml version1.0?gt
  • ltpurchaseOrder orderDate1999-10-20gt
  • ltshipTo countryUSgt
  • ltnamegtMatthias Hauswirthlt/namegt
  • ltstreetgt4500 Brookfield Dr.lt/streetgt
  • ltcitygtBoulderlt/citygt
  • ltstategtCOlt/stategt
  • ltzipgt80303lt/zipgt
  • lt/shipTogt
  • ltbillTo countryUSgt
  • ltnamegtBrian Templelt/namegt
  • ltstreetgt1234 Strasselt/streetgt
  • ltcitygtBoulderlt/citygt
  • ltstategtCOlt/stategt
  • ltzipgt80302lt/zipgt
  • lt/billTogt
  • ltcommentgtBrian payslt/commentgt
  • ltitemsgt
  • ltitem partNum123-ABgt
  • ltproductNamegtPorschelt/productNamegt
  • ltquantitygt1lt/quantitygt
  • ltpricegt129400.00lt/pricegt
  • ltcommentgtNeed a new onelt/commentgt
  • lt/itemgt
  • ltitemgt
  • ltproductNamegtFerrarilt/productNamegt
  • ltquantitygt2lt/quantitygt
  • ltpricegt189000.25lt/pricegt
  • ltshipDategt1999-05-21lt/shipDategt
  • lt/itemgt
  • lt/itemsgt
  • lt/purchaseOrdergt

5
Simple XSL Document
  • lt?xml version"1.0"?gt
  • ltxslstylesheet xmlnsxsl"http//www.w3.org/TR/WD
    -xsl"gt
  • ltxsltemplate match"/"gt
  • ltHTMLgt
  • ltBODYgt
  • lttable border"2" bgcolor"yellow"gt
  • ltxslfor-each select"records/purchaseOrde
    r"gt
  • lttrgt
  • lttdgtltxslvalue-of
    select"shipTo/name"/gtlt/tdgt
  • lttdgtltxslvalue-of
    select"comment"/gtlt/tdgt
  • ltxslfor-each select"items/item"gt
  • lttdgtltxslvalue-of
    select"price"/gtlt/tdgt
  • lt/xslfor-eachgt
  • lt/trgt
  • lt/xslfor-eachgt
  • lt/tablegt
  • lt/BODYgt
  • lt/HTMLgt
  • lt/xsltemplategt

6
Simple XSL Results
7
XSLCHOOSE
  • ltxslstylesheet xmlnsxsl"http//www.w3.org/TR/WD
    -xsl"gt
  • ltxsltemplate match"/"gt
  • ltHTMLgt
  • ltBODYgt
  • lttable border"2" bgcolor"yellow"gt
  • ltxslfor-each select"records/purchaseOrde
    r"gt
  • lttrgt
  • lttdgtltxslvalue-of
    select"shipTo/name"/gtlt/tdgt
  • lttdgtltxslvalue-of
    select"comment"/gtlt/tdgt
  • ltxslfor-each select"items/item"gt
  • ltxslchoosegt
  • ltxslwhen match".pricegt100"gt
  • lttd bgcolor"red"gtltxslvalue-of
    select"price"/gtlt/tdgt
  • lt/xslwhengt
  • ltxslotherwisegt
  • lttdgtltxslvalue-of
    select"price"/gtlt/tdgt
  • lt/xslotherwisegt
  • lt/xslchoosegt
  • lt/xslfor-eachgt
  • lt/trgt
  • lt/xslfor-eachgt
  • lt/tablegt
  • lt/BODYgt
  • lt/HTMLgt
  • lt/xsltemplategt
  • lt/xslstylesheetgt

8
XSLCHOOSE 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
Fe Fi FO Fum
  • ltdocgt ltpgtThis is an ltemphgtimportant wordlt/emphgt
    in this sentence that also refers to a
    ltcodegtvariablelt/codegt.lt/pgt lt/docgt
  • lt?xml version'1.0'?gt
  • ltxslstylesheet xmlnsxsl"http//www.w3.org/1999
    /XSL/Transform" xmlnsfo"http//www.w3.org/1999/X
    SL/Format" version'1.0'gt
  • ...
  • ltxsltemplate match"code"gt
  • ltfowrapper font-family"Courier"gt
  • ltxslapply-templates/gt
  • lt/fowrappergt
  • lt/xsltemplategt

14
Examples of Formatting Objects
  • 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
  • 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
  • static-content
  • table
  • table-and-caption
  • table-body
  • table-caption
  • table-cell
  • table-column
  • table-footer
  • table-header
  • table-row
  • title
  • wrapper
Write a Comment
User Comments (0)
About PowerShow.com