XSLT and XPath Overview - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

XSLT and XPath Overview

Description:

In relation to the current context node, this operator selects the parent. ... item Prawn cocktail /item item Garlic mushroom /item item Pate and toast /item ... – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 29
Provided by: davea6
Category:
Tags: xslt | overview | prawn | xpath

less

Transcript and Presenter's Notes

Title: XSLT and XPath Overview


1
Unit 3
  • XSLT and XPath Overview

2
Section Objectives
  • Introduction
  • XPath
  • Applying Stylesheets
  • XSLT Language

3
Introduction to Extensible Stylesheet Language
(XSL)
  • DOM Used to Navigate and Edit
  • XSL used to Transform and Format
  • XSLT Recommendation
  • Our Focus
  • Presentation use CSS
  • Covered Later

4
XSL Transformations (XSLT)
  • Transform XML
  • XML to another XML
  • XML to file
  • XML to HTML
  • XSLT is well-formed XML
  • Inter-Application Communication

5
XSL Processor
Transformed and Formatted Document
XSL Processor
6
Section Objectives
  • Introduction
  • XPath
  • Applying Stylesheets
  • XSLT Language

7
XPath Abbreviated Notation
8
XPath Abbreviated Notation
9
XPath Pattern Filters
  • Node Index Position
  • Node Test
  • text()
  • comment()
  • processing-instruction()
  • node()
  • Core Function Library

10
Section Objectives
  • Introduction
  • XPath
  • Applying Stylesheets
  • XSLT Language

11
XSL Root Element
lt?xml version "1.0"?gt ltxslstylesheet xmlnsxsl
"http//www.w3.org/TR/WD-xsl"gt   all other
declarations   lt/xslstylesheetgt
12
Applying XSL Stylesheets to XML
  lt?xml-stylesheet type "text/xsl" href
"XSLFile.xsl"?gt  
13
Basic XSL Elements and Operations
  • XML is Tree-based
  • XSLT Processor
  • One XML Tree -gt Another XML Tree
  • Key Selection is Template
  • Processor Applies Templates

14
Section Objectives
  • Introduction
  • XPath
  • Applying Stylesheets
  • XSLT Language

15
xsltemplate
ltxsltemplate match pattern name qname
priority number, mode qnamegt instructions
lt/xsltemplategt
If for instance an XML document has an
element   ltitemgtThis is some textlt/itemgt   then
a template that matches this node could be
defined as
ltxsltemplate match itemgt lt/xsltemplategt
16
XSL Document Structure and Processor Action
lt?xml version "1.0"?gt ltxslstylesheet xmlnsxsl
""gt ltxsltemplate match patterngt actions lt/xs
ltemplategt ltxsltemplate match pattern
gt actions lt/xsltemplategt ltxsltemplate match
pattern gt actions lt/xsltemplategt
etc lt/xslstylesheetgt
17
XSL Document Structure and Processor Action
The top-level template is The pattern /
means the root node of the document
ltxsltemplate match "/"gt instructions
lt/xsltemplategt
18
xslvalue-of
ltxslvalue-of  select pattern disable-output-e
scaping "yes" "no" /gt
19
xslvalue-of Example
Example01.xml
Example01.xsl
Run Example01.bat
20
xslvalue-of Example
Example01.xml
Example02.xsl
Run Example02.bat
21
xslapply-templates
ltxslapply-templates select pattern  mode
qname/gt
22
Patterns
  • Patterns for Filtering
  • Conflicts in Matching Process

23
XPath Relational Operators
24
XPath Boolean Operators

25
XPath Boolean Functions
26
Control Flow
27
Copying XML Elements to Output
ltxslcopy use-attribute-sets qnamesgtlt/xslcop
ygt ltxslcopy-of select expression /gt
Example13a.xsl and Example13b.xsl use with
Example10.xml Run Example13.bat
28
Creating New XML
  • xslattribute
  • xslattribute-set
  • xslelement
  • xslcomment
  • xslprocessing-instruction
Write a Comment
User Comments (0)
About PowerShow.com