Transforming XML Part I Document Navigation with XPath John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel: 0131 551.

Slides:



Advertisements
Similar presentations
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
Advertisements

UFCE8V-20-3 Information Systems Development 3 (SHAPE HK) Lecture 12 Extensible Stylesheet Language Transformations : XSLT.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
XSLT (eXtensible Stylesheet Language Transformation) 1.
Managing Data Exchange: XPath
XPath XML Path Language. Outline XML Path Language (XPath) Data Model Description Node values XPath expressions Relative expressions Simple subset of.
XPath. XPath Used to access part of XML document Used to access part of XML document Compact, non-XML syntax Compact, non-XML syntax Use a pattern expression.
The learning site: /xpath_syntax.asp xsl/xsl/slides.html.
XPath Eugenia Fernandez IUPUI. XML Path Language (XPath) a data model for representing an XML document as an abstract node tree a mechanism for addressing.
SDPL 2002Notes 5: XSLT1 5. Document Transformations n XSLT (W3C Rec. November 1999) –A language for transforming XML documents »representative of tree-based.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
SDPL 2003Notes 5: XSLT1 5. Document Transformations n XSLT (W3C Rec. November 1999) –A language for transforming XML documents »representative of tree-based.
XSLT Stylesheets Some more advanced examples (adapted from the Edinburgh LT site)
XSL Concepts Lecture 7. XML Display Options What can XSL Transformations do? generation of constant text suppression of content moving text (e.g., exchanging.
XSL Transformations Lecture 8, 07/08/02. Templates The whole element is a template The match pattern determines where this template applies Result element(s)
XPath Xml processing as a tree. Introduction Although XML provides a flexible and expressive way of describing data, it does not have a mechanism for.
XML Language Family Detailed Examples Most information contained in these slide comes from: These slides are intended.
Managing XML and Semistructured Data Lecture 6: XPath Prof. Dan Suciu Spring 2001.
XPath Carissa Mills Jill Kerschbaum. What is XPath? n A language designed to be used by both XSL Transformations (XSLT) and XPointer. n Provides common.
Lecture 12. Default Processing in XSLT The default processing in XSLT is to process the XPath root node The default processing for various node types.
XPath Tao Wan March 04, What is XPath? n A language designed to be used by XSL Transformations (XSLT), Xlink, Xpointer and XML Query. n Primary.
Cornell CS 502 More XML XML schema, XPATH, XSLT CS 502 – Carl Lagoze – Cornell University.
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
17 Apr 2002 XML Stylesheets Andy Clark. What Is It? Extensible Stylesheet Language (XSL) Language for document transformation – Transformation (XSLT)
Introduction to XPath Bun Yue Professor, CS/CIS UHCL.
XSLT XSLT: eXtensible Stylesheet Language for Transformations - a language for transforming XML documents into any text- based format (e.g. HTML, plain.
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
10/06/041 XSLT: crash course or Programming Language Design Principle XSLT-intro.ppt 10, Jun, 2004.
Navigating XML. Overview  Xpath is a non-xml syntax to be used with XSLT and Xpointer. Its purpose according to the W3.org is  to address parts of an.
CSE3201/CSE4500 XPath. 2 XPath A locator for elements or attributes in an XML document. XPath expression gives direction.
TDDD43 XML and RDF Slides based on slides by Lena Strömbäck and Fang Wei-Kleiner 1.
SDPL 20075: Overview of XSLT1 5 Document Transformations n XSLT (1.0 W3C Rec. 11/1999; XSLT 2.0 Rec. 1/07) –A language for transforming XML documents –initial.
1/17 ITApplications XML Module Session 7: Introduction to XPath.
Introduction to XPath Web Engineering, SS 2007 Tomáš Pitner.
CSE3201/CSE4500 Information Retrieval Systems
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
XSLT and XPath, by Dr. Khalil1 XSL, XSLT and XPath Dr. Awad Khalil Computer Science Department AUC.
WORKING WITH XSLT AND XPATH
Session II Chapter 2 – Chapter 2 – XSLhttp://
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
Transforming XML Part II XML Document Transformation with XSLT John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel:
Lecture 14 Extensible Stylesheet Language Transformations : XSLT.
XPath Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Processing of structured documents Spring 2003, Part 7 Helena Ahonen-Myka.
XPath. Why XPath? Common syntax, semantics for [XSLT] [XPointer][XSLT] [XPointer] Used to address parts of an XML document Provides basic facilities for.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XSLT I Robin Burke ECT 360. Outline XSLT processing XSLT syntax XPath XSLT basics Lab.
XSLT part of XSL (Extensible Stylesheet Language) –includes also XPath and XSL Formatting Objects used to transform an XML document into: –another XML.
Lecture 11 XSL Transformations (part 1: Introduction)
Lecture 6: XML Query Languages Thursday, January 18, 2001.
XPath Aug ’10 – Dec ‘10. XPath   XML Path Language   Technology that allows to select a part or parts of an XML document to process   XPath was.
 2002 Prentice Hall, Inc. All rights reserved. 1 Chapter 12 – XSL: Extensible Stylesheet Language Transformations (XSLT) Outline 12.1Introduction 12.2Setup.
SDPL 2001Notes 5: XSLT1 5. Document Transformations n XSLT (W3C Rec. Nov-99) –A language for transforming XML documents »representative of features common.
WPI, MOHAMED ELTABAKH PROCESSING AND QUERYING XML 1.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
XPath. XPath, the XML Path Language, is a query language for selecting nodes from an XML document. The XPath language is based on a tree representation.
More XML XPATH, XSLT CS 431 – February 23, 2005 Carl Lagoze – Cornell University.
 XSL – Extensible Style Sheet Language  XSLT – XSL Transformations › Used to transform XML documents to other formats,like HTML or other XML documents.
Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0http://
University of Nottingham School of Computer Science & Information Technology Introduction to XML 2. XSLT Tim Brailsford.
Martin Kruliš by Martin Kruliš (v1.1)1.
XPath --XML Path Language Motivation of XPath Data Model and Data Types Node Types Location Steps Functions XPath 2.0 Additional Functionality and its.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
XSLT I Robin Burke ECT 360. Outline History / Terminology XSLT processing XSLT syntax XPath XSLT basics Lab.
1 The XPath Language. 2 XPath Expressions Flexible notation for navigating around trees A basic technology that is widely used uniqueness and scope in.
5 Copyright © 2004, Oracle. All rights reserved. Navigating XML Documents by Using XPath.
1 XSL Transformations (XSLT). 2 XSLT XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. XSLT uses XPath.
XML Query languages--XPath. Objectives Understand XPath, and be able to use XPath expressions to find fragments of an XML document Understand tree patterns,
XML Path Language Andy Clark 17 Apr 2002.
More XML XML schema, XPATH, XSLT
Presentation transcript:

Transforming XML Part I Document Navigation with XPath John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel: (x2073)

Contents Document Processing Nodes and Trees XPath: Locating Nodes Summary Find Out More

Document Processing The XSL Family –XPath (XML Path Language) –XSLT (Extensible Stylesheet Language Transformations) –XSL aka XSL-FO (Extensible Stylesheet Language Formatting Objects)

Document Processing XPath –Used to locate specific parts of an XML source document efficiently and effectively –XPath v1.0 W3C Recommendation

Document Processing XSLT –Used to transform XML documents to another XML or non-XML form – esp. HTML –XSLT v1.0 W3C Recommendation v2.0 W3C Working Draft –Uses XPath for locating document content

Document Processing XSL(-FO) –Used to format XML documents into fixed sized folios for publication –XSL v1.0 W3C Recommendation –Uses XSLT for document transformation

Document Processing Transformation and formatting –XPath used to locate nodes for input –XSLT used to transform input and generate result tree –XSL-FO used to format output document

Document Processing Adapted from XSLT Basics slide presentation by Paul Spencer, alphaXML Source Tree Style sheet FormatTransform Result Tree Formatted Output Stylesheet Processor

Trees and Nodes XML document is viewed as a source tree containing different node types –root –element –text –attribute –namespace –processing instruction –comment

Trees and Nodes XML Appointment example John Smith Alison Young 14:30:00

Trees and Nodes XPath view of Appointment source tree

XPath: Locating Nodes XPath expressions (location paths) –Used to navigate source tree and locate nodes for input –Comprised of one or more location steps axis + node test + (optional) predicate –May contain functions, e.g. position(), count(node-set), last()

XPath: Locating Nodes Axes –Specify node locations relative to the current (context) node = self –May traverse tree forwards or backwards

XPath: Locating Nodes Axes for forward traversal –child –attribute –descendant-or-self –descendant –following –following-sibling –namespace

XPath: Locating Nodes Axes for reverse traversal –parent –ancestor –ancestor-or-self –preceding –preceding-sibling

XPath: Locating Nodes Node Tests –Refine node set selection * = select all nodes of same type node() = select all nodes of any type Select all nodes of type text(), comment() or processing- instruction() Select all nodes with specified name

XPath: Locating Nodes Select Clinician element node child::Appointment/child::Clinician or Appointment/Clinician

XPath: Locating Nodes Select upi attribute node child::Patient/attribute::upi or

XPath: Locating Nodes Select all descendant text nodes /descendant-or-self::node()/child::text() or //text()

XPath: Locating Nodes Select parent of StartTime element parent::node() or..

XPath: Locating Nodes Using wildcards child::* or *

XPath: Locating Nodes Abbreviating location steps –child:: and text() can usually be omitted child::Appointment/child::Clinician/child ::text() = Appointment/Clinician –attribute:: –self()::node =. –parent::node() =..

XPath: Locating Nodes Abbreviating Location Paths /descendant-or-self::node()/ = // /descendant-or-self::node()/child::text() = //text()

In Summary… XML document processing: –XPath - node location –XSLT - transformation –XSL-(FO) - document formatting XPath used to navigate source tree Transformation performed by applying style sheet to source document

Find Out More The Extensible Stylesheet Language Family (XSL) – W3C XML Path Language v1.0 Specification – TopXML XSLT & XPath Tutorial – efault.aspwww.vbxml.com/xsl/tutorials/intro/d efault.asp