Title: XSLT and XPath Overview
1Unit 3
2Section Objectives
- Introduction
- XPath
- Applying Stylesheets
- XSLT Language
3Introduction 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
4XSL Transformations (XSLT)
- Transform XML
- XML to another XML
- XML to file
- XML to HTML
- XSLT is well-formed XML
- Inter-Application Communication
5XSL Processor
Transformed and Formatted Document
XSL Processor
6Section Objectives
- Introduction
- XPath
- Applying Stylesheets
- XSLT Language
7XPath Abbreviated Notation
8XPath Abbreviated Notation
9XPath Pattern Filters
- Node Index Position
- Node Test
- text()
- comment()
- processing-instruction()
- node()
- Core Function Library
10Section Objectives
- Introduction
- XPath
- Applying Stylesheets
- XSLT Language
11XSL Root Element
lt?xml version "1.0"?gt ltxslstylesheet xmlnsxsl
"http//www.w3.org/TR/WD-xsl"gt  all other
declarations  lt/xslstylesheetgt
12Applying XSL Stylesheets to XML
 lt?xml-stylesheet type "text/xsl" href
"XSLFile.xsl"?gt Â
13Basic XSL Elements and Operations
- XML is Tree-based
- XSLT Processor
- One XML Tree -gt Another XML Tree
- Key Selection is Template
- Processor Applies Templates
14Section Objectives
- Introduction
- XPath
- Applying Stylesheets
- XSLT Language
15xsltemplate
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
16XSL 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
17XSL 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
18xslvalue-of
ltxslvalue-of  select pattern disable-output-e
scaping "yes" "no"Â /gt
19xslvalue-of Example
Example01.xml
Example01.xsl
Run Example01.bat
20xslvalue-of Example
Example01.xml
Example02.xsl
Run Example02.bat
21xslapply-templates
ltxslapply-templates select pattern  mode
qname/gt
22Patterns
- Patterns for Filtering
- Conflicts in Matching Process
23XPath Relational Operators
24XPath Boolean Operators
25XPath Boolean Functions
26Control Flow
27Copying 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
28Creating New XML
- xslattribute
- xslattribute-set
- xslelement
- xslcomment
- xslprocessing-instruction