XSL EXtensible Stylesheet Language - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

XSL EXtensible Stylesheet Language

Description:

artist Bob Dylan /artist country USA /country company Columbia /company ... artist Bob Dylan /artist The xsl:template Element ... – PowerPoint PPT presentation

Number of Views:128
Avg rating:3.0/5.0
Slides: 23
Provided by: acsd4
Category:

less

Transcript and Presenter's Notes

Title: XSL EXtensible Stylesheet Language


1
XSLEXtensible Stylesheet Language
  • Source w3schools.com

2
CSS vs. XSL
  • CSS HTML Style Sheets XSL XML Style Sheets

3
XSL - More Than a Style Sheet Language
  • XSL consists of three parts
  • XSLT - a language for transforming XML documents
  • XPath - a language for navigating in XML
    documents
  • XSL-FO - a language for formatting XML documents

4
XSLT
  • XSLT is a language for transforming XML documents
    into X/HTML documents or to other XML documents.

5
XSLT
  • XSLT stands for XSL Transformations
  • XSLT is the most important part of XSL
  • XSLT transforms an XML document into another XML
    document
  • XSLT uses XPath to navigate in XML documents
  • XSLT is a W3C Recommendation

6
XSLT
  • XSLT is used to transform an XML document into
    another XML document, or another type of
    document.
  • With XSLT you can add/remove elements and
    attributes to or from the output file. You can
    also rearrange and sort elements, perform tests
    and make decisions about which elements to hide
    and display, and a lot more.

7
Style Sheet Declaration
  • w.w3.org/1999/XSL/Transform"
  • or
  • .w3.org/1999/XSL/Transform"

8
Raw XML Document
  • We want to transform the following XML document
    ("cdcatalog.xml") into XHTML version"1.0" encoding"ISO-8859-1"?
    Empire Burlesque
    Bob Dylan
    USA Columbiaompany 10.90 1985ar . . .

9
  • ylesheet version"1.0"
  • xmlnsxsl"http//www.w3.org/1999/XSL/Transform"
  • My CD Collection
  • Title
  • Artist

XSL Style Sheet cdcatalog.xsl
10
Linking XML with XSL
  • Add the XSL style sheet reference to your XML
    document ("cdcatalog.xml")
  • href"cdcatalog.xsl"?
  • Empire Burlesque
  • Bob Dylan
  • ...

11
The Element
  • The element is used to build
    templates.
  • The match attribute is used to associate a
    template with an XML element.
  • The match attribute can also be used to define a
    template for the entire XML document. The value
    of the match attribute is an XPath expression
    (i.e. match"/" defines the whole document and
    associates the template with the root of the XML
    document).

12
The Element
  • The element can be used to extract
    the value of an XML element and add it to the
    output stream of the transformation


13
The Element
  • The element allows you to do
    looping in XSLT.
  • It is used to select every XML element of a
    specified node-set.


14
Example
  • XML file XSL file View the result

15
Filtering the Output
  • We can also filter the output from the XML file
    by adding a criterion to the select attribute in
    the element.
  • Dylan'"
  • Legal filter operators are
  •   (equal)
  • ! (not equal)
  • lt less than
  • gt greater than View the XML file, View the
    XSL file, View the result

16
The element
  • The element is used to sort the
    output.
  • To sort the output, simply add an
    element inside the element in the
    XSL file
  • View the XML file, View the XSL file, and View
    the result

17
The Element
  • The element is used to put a conditional
    test against the content of the XML file.
  • Syntax
  • ...
  • ...some output if the expression is true...
  • ...

18
- Example

  • View the XML file, View the XSL file, and View
    the result

19
The Element
  • The element is used in conjunction
    with and to
    express multiple conditional tests.

20
- Syntax
  • ... some output ...
  • ... some output ....

21
- Example
  • d
  • View the XML file, View the XSL file, and View
    the result

22
- Another Example
  • lt 10"
  • d
  • View the XML file, View
    the XSL file, and View the result
Write a Comment
User Comments (0)
About PowerShow.com