Introduction to XML 2. XSLT - PowerPoint PPT Presentation

Loading...

PPT – Introduction to XML 2. XSLT PowerPoint presentation | free to download - id: dfde9-ZDc1Z



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Introduction to XML 2. XSLT

Description:

XSL language consists of directives (ie elements ... XSL stylesheets are not a ... XSL may contain variables (numeric or string), it may perform ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 22
Provided by: Brail
Learn more at: http://www.cs.nott.ac.uk
Category:
Tags: xml | xslt | introduction | xsl

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Introduction to XML 2. XSLT


1
Introduction to XML 2. XSLT
  • Tim Brailsford

2
XSL / XSLT / FO
  • eXtensible Stylesheet Language
  • A language (an XML application) to define the
    appearance and behaviour of an XML document.
  • Transformation
  • The logical restructuring of a source document
    to produce a result document.
  • For example XML ? HTML
  • Formatting
  • The precise description of screen/page layout.
  • XSLT vs FO

3
The XSLT Language
  • XML syntax (using the xsl namespace)
  • XSL language consists of directives (ie elements
    in this namespace)
  • Rule-based
  • stylesheets consist of a series of templates that
    contain rules for the processing of a particular
    element.
  • XSL stylesheets are not a sequential programming
    language - rules are applied depending upon the
    logical structure of the document.
  • Rules may be conditional
  • XSL may contain variables (numeric or string), it
    may perform arithmetic calculations.
  • There is a library of parameterised functions

4
The Tree Model of XML
ltdefinitiongt ltwordgtexportlt/wordgt
ltpart-of-speechgtvtlt/part-of-speechgt ltmeaninggt
Send out (goods) to another countrylt/meaninggt
ltetymologygt ltlanguagegtLatinlt/languagegt
ltpartsgt ltpartgt
ltprefixgtexlt/prefixgt
ltmeaninggtoutlt/meaninggt lt/partgt
ltpartgt ltwordgtportarelt/wordgt
ltmeaninggtto carrylt/meaninggt
lt/partgt lt/partsgt lt/etymologygt lt/definiti
ongt
5
The Tree Model of XML
6
The Tree Model of XML
ltdefinitiongt
ltwordgt
ltmeaninggt
ltetymologygt
ltpart-of-speechgt
ltlanguagegt
ltpartsgt
ltprefixgt
ltwordgt
ltmeaninggt
7
XML Node Types
  • Root Node
  • The top level node (1 per document)
  • Element Node
  • An element bound by a start and finish tag (or a
    single empty-element tag)
  • Text Node
  • A sequence of consecutive characters (PCDATA)
  • Attribute Node
  • The name and value of an attribute inside an
    element
  • Comment Node
  • Processing Instruction Node
  • Namespace Node

8
XML Node Relationships
  • Self
  • Parent
  • Ancestor
  • Child
  • Descendant
  • Following
  • Following-Sibling
  • Preceding
  • Preceding-Sibling

9
Self
1
10
Parent
1
11
Ancestor
2
1
12
Child
1
2
13
Descendant
1
2
3
4
5
14
Following
1
4
2
3
5
6
15
Following-Sibling
1
2
16
Preceding
3
2
1
17
Preceding-Sibling
2
1
18
XSL Templates
  • ltxsltemplate matchGREETINGgt . .
    . lt/xsltemplategt
  • Templates contain transformation rules
  • either XSL directives or valid XML output.
  • Templates are matched to an XML node.

see greeting-1.xsl
19
XPATH
  • XPATH is a sub-language within XSLT - used to
    identify components of the document.
  • XPATH expressions can be used to match a
    template, or the contents of an element.
  • Example
  • ltxsltemplate matchGREETINGgt

20
Example XPATH Expressions
  • ltxsltemplate matchGREETINGgt
  • ltxsltemplate matchGREETING/MESSAGE/TITLEgt
  • ltxslvalue-of selectMESSAGEgt
  • ltxslvalue-of select_at_titlegt
  • ./MESSAGE
  • ../MESSAGE
  • /MESSAGE
  • MESSAGE/TITLEMESSAGE/BODY
  • ancestor(CHAPTER)/HEAD
  • BOOK_at_title
  • BOOKnot(_at_title)
  • //BOOK_at_categoryfiction

21
XSL apply-templates directive
  • ltxslapply-templates /gt
  • Specifies that immediate children of a node
    should be processed further.
  • It is possible to specify which children with an
    optional selectxpath ltxslapply-templates
    selectbook /gt

see greeting-2.xsl
About PowerShow.com