Download presentation
Presentation is loading. Please wait.
Published byPatricia Paul Modified over 8 years ago
1
XSLT, XML Schema, and XPath Matt McClelland
2
Introduction XML Schema ▫Defines the content and structure of XML data. XSLT ▫Used to transform XML documents into other XML documents or text-based formats such as HTML and PDF. XPath ▫Used as a way to locate and tag “items” or nodes in an XML document.
3
XML Schema What is an XML Schema? ▫XML Schema documents are used to define and validate the content and structure of XML Data. ▫Primarily used to separate content from formatting
4
XML Schema (cont.) Follows Strict Hierarchical Structure ▫Every well-formed XML Schema document (.xsd) follows a tree-like structure Contains root, child, and leaf nodes/tags ▫Restricts documents to a fixed vocabulary and validates documents to ensure they follow the rules of the dialect Contains only Structural/Semantic Data ▫XML Documents contain NO formatting information..
5
XSLT What is XSLT? ▫XSLT stands for eXtensible Stylesheet Language Transformations. ▫Used in conjunction with XSL Stylesheets and XPath to render and style XML and other text- based documents.
6
XSLT (cont.) AdvantagesDisadvantages Clean, concise templates Relatively fast Provides an easy, platform neutral way to render XML into HTML, PDF, and other XML docs Stylesheets may become difficult to maintain, especially if left unkempt Not easily readable or understandable at a glance Not supported by all web crawlers or older internet browsers
7
XPath What is XPath? ▫XPath is a query language often used in conjunction with XSLT for selecting nodes from an XML document. ▫A ddresses ‘parts’ of an XML document and provides basic facilities for computing and manipulating strings, numbers, and booleans from the content of an XML document.
8
XPath (cont.) How does it work? ▫XPath uses a compact, string-based, rather than XML element-based syntax. ▫Operates on the abstract, logical structure of an XML document (tree of nodes) rather than its surface syntax. ▫Uses a path notation (much like URLs) to navigate through the XML’s hierarchical tree structure.
9
Sample XML Specify XSL Stylesheet
10
XSLT Example classical.xsl Authors Composers from Austria Name <xsl:for-each select="/authors/author[nationality='Austrian']"> XSL version XPath
11
Output Original XML Transformed XML
12
Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.