Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
XML: Extensible Markup Language
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
An Introduction to XML Based on the W3C XML Recommendations.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
Introduction to XLink Transparency No. 1 XML Information Set W3C Recommendation 24 October 2001 (1stEdition) 4 February 2004 (2ndEdition) Cheng-Chia Chen.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 3 Style Sheets: CSS WEB.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Tutorial 11 Creating XML Document
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Copyright © 2003 Pearson Education, Inc. Slide 2-1 Created by Cheryl M. Hughes, Harvard University Extension School — Cambridge, MA The Web Wizard’s Guide.
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.
ECA 228 Internet/Intranet Design I Intro to XML. ECA 228 Internet/Intranet Design I HTML markup language very loose standards browsers adjust for non-standard.
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
XP Tutorial 9New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XML eXtensible Markup Language by Darrell Payne. Experience Logicon / Sterling Federal C, C++, JavaScript/Jscript, Shell Script, Perl XML Training XML.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
WORKING WITH XSLT AND XPATH
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
August Chapter 2 - Markup and Core Concepts Learning XML by Erik T. Ray Slides were developed by Jack Davis College of Information Science and Technology.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
Lecture 6 XML DTD Content of.xml fileContent of.dtd file.
1 Dr Alexiei Dingli XML Technologies XML Advanced.
XPath. Why XPath? Common syntax, semantics for [XSLT] [XPointer][XSLT] [XPointer] Used to address parts of an XML document Provides basic facilities for.
ECA 228 Internet/Intranet Design I XSLT Example. ECA 228 Internet/Intranet Design I 2 CSS Limitations cannot modify content cannot insert additional text.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter X IXXXXXXXXXX XXXXXX.
Softsmith Infotech XML. Softsmith Infotech XML EXtensible Markup Language XML is a markup language much like HTML Designed to carry data, not to display.
E0262 – MIS – Multimedia Storage Techniques XML (Extensible Markup Language  XML is a markup language for creating documents containing structured information.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
School of Computing and Information Systems CS 371 Web Application Programming XML and JSON Encoding Data.
1 Introduction to XML XML stands for Extensible Markup Language. Because it is extensible, XML has been used to create a wide variety of different markup.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
Web Technologies Lecture 4 XML and XHTML. XML Extensible Markup Language Set of rules for encoding a document in a format readable – By humans, and –
When we create.rtf document apart from saving the actual info the tool saves additional info like start of a paragraph, bold, size of the font.. Etc. This.
More XML XPATH, XSLT CS 431 – February 23, 2005 Carl Lagoze – Cornell University.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
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.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 14 This presentation © 2004, MacAvon Media Productions XML.
XML Introduction to XML Extensible Markup Language.
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 Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
Unit 4 Representing Web Data: XML
XML in Web Technologies
Chapter 7 Representing Web Data: XML
Chapter X IXXXXXXXXXXXXXXXX.
More XML XML schema, XPATH, XSLT
Presentation transcript:

Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides2 XML  Example XML document:  An XML document is one that follows certain syntax rules (most of which we followed for XHTML)

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides3 XML Syntax  An XML document consists of Markup Tags, which begin with References, which begin with & and end with ;  Character, e.g.  Entity, e.g. <  The entities lt, gt, amp, apos, and quot are recognized in every XML document.  Other XHTML entities, such as nbsp, are only recognized in other XML documents if they are defined in the DTD Character data: everything not markup

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides4 XML Syntax  Comments Begin with <!-- End --> Must not contain –  CDATA section Special element the entire content of which is interpreted as character data, even if it appears to be markup Begins with <![CDATA[ Ends with ]]> (illegal except when ending CDATA)

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides5 XML Syntax  The CDATA section is equivalent to the markup

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides6 XML Syntax  < and & must be represented by references except When beginning markup Within comments Within CDATA sections

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides7 XML Syntax  Element tags and elements Three types Start, e.g. End, e.g. Empty element, e.g. Start and end tags must properly nest Corresponding pair of start and end element tags plus everything in between them defines an element Character data may only appear within an element

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides8 XML Syntax  Start and empty-element tags may contain attribute specifications separated by white space Syntax: name = quoted value quoted value must not contain <, can contain & only if used as start of reference quoted value must begin and end with matching quote characters ( ‘ or “ )

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides9 XML Syntax  Element and attribute names are case sensitive  XML white space characters are space, carriage return, line feed, and tab

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides10 XML Documents  A well-formed XML document follows the XML syntax rules and has a single root element  Well-formed documents have a tree structure  Many XML parsers (software for reading/writing XML documents) use tree representation internally

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides11 XML Documents  An XML document is written according to an XML vocabulary that defines Recognized element and attribute names Allowable element content Semantics of elements and attributes  XHTML is one widely-used XML vocabulary  Another example: RSS (rich site summary)

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides12 XML Documents

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides13 XML Documents

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides14 XML Documents  Valid names and content for an XML vocabulary can be specified using Natural language XML DTDs (Chapter 2) XML Schema (Chapter 9)  If DTD is used, then XML document can include a document type declaration:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides15 XML Documents  Two types of XML parsers: Validating Requires document type declaration Generates error if document does not  Conform with DTD and  Meet XML validity constraints  Example: every attribute value of type ID must be unique within the document Non-validating Checks for well-formedness Can ignore external DTD

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides16 XML Documents  Good practice to begin XML documents with an XML declaration Minimal example: If included, < must be very first character of the document To override default UTF-8/UTF-16 character encoding, include encoding declaration following version:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides17 XML Documents  Internal subset of DTD Entity vsn will be defined by any XML parser, validating or not Declaration of internal subset of DTD

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides18 XML Namespaces  XML Namespace: Collection of element and attribute names associated with an XML vocabulary  Namespace Name: Absolute URI that is the name of the namespace Ex: is the namespace name of XHTML 1.0http://  Default namespace for elements of a document is specified using a form of the xmlns attribute:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides19 XML Namespaces  Another form of xmlns attribute known as a namespace declaration can be used to associate a namespace prefix with a namespace name: Namespace prefix Namespace declaration

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides20 XML Namespaces  Example use of namespace prefix:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides21 XML Namespaces  In a namespace-aware XML application, all element and attribute names are considered qualified names A qualified name has an associated expanded name that consists of a namespace name and a local name Ex: item is a qualified name with expanded name Ex: xhtml:a is a qualified name with expanded name

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides22 XML Namespaces  Other namespace usage: A namespace can be declared and used on the same element

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides23 XML Namespaces  Other namespace usage: A namespace prefix can be redefined for an element and its content These elements belong to

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides24 JavaScript and XML  JavaScript DOM can be used to process XML documents  JavaScript XML Dom processing is often used with XMLHttpRequest Host object that is a constructor for other host objects Sends an HTTP request to server, receives back an XML document

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides25 JavaScript and XML  Example use: Previous visit count servlet: must reload document to see updated count Visit count with XMLHttpRequest : browser will automatically update the visit count periodically without reloading the entire page

Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved JavaScript and XML Document generated by GET request to VisitCountUpdate servlet JavaScript file using XMLHttpRequest object span that will be updated by JavaScript code

Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved JavaScript and XML XMLHttpRequest request is processed by doPost() method of servlet Response is XML document Current visit count is returned as content of count XML element

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides28 JavaScript and XML

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides29 JavaScript and XML Typical code for creating an instance of XMLHttpRequest

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides30 JavaScript and XML Return immediately after sending request (asynchronous behavior) Function called as state of connection changes Body of request (empty in this example)

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides31 JavaScript and XML Indicates response received successfully Root of returned XML document

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides32 JavaScript and XML  Ajax: Asynchronous JavaScript and XML  Combination of (X)HTML XML CSS JavaScript JavaScript DOM (HTML and XML) XMLHttpRequest in asynchronous mode

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides33 Java-based DOM  Java DOM API defined by org.w3c.dom package  Semantically similar to JavaScript DOM API, but many small syntactic differences Nodes of DOM tree belong to classes such as Node, Document, Element, Text Non-method properties accessed via methods Ex: parentNode accessed by calling getParentNode()

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides34 Java-based DOM  Methods such as getElementsByTagName() return instance of NodeList getLength() method returns # of items item() method returns an item

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides35 Java-based DOM  Example: program to count link elements in an RSS document:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides36 Java-based DOM  Imports: From Java API for XML Processing (JAXP)

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides37 Java-based DOM  Default parser is non-validating and non- namespace-aware.  Overriding:  Also setValidating(true)

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides38 Java-based DOM  Namespace-aware versions of methods end in NS: Namespace name Local name

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides39 SAX

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides40 SAX

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides41 SAX

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides42 SAX Used if not namespace-aware or if qualified name does not belong to any namespace.

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides43 SAX

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides44 Transformations  JAXP provides API for transforming between DOM, SAX, and Stream (text) representations of XML documents  Example: Input from stream to DOM Modify DOM Output as stream

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides45 Transformations

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides46 Transformations

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides47 Transformations  “SAX output” means that a SAX event handler is called: Example: the code feeds the XML document represented by DOM document through the SAX event handler CountElementsHelper()

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides48 XSL  The Extensible Stylesheet Language (XSL) is an XML vocabulary typically used to transform XML documents from one form to another form XSL document Input XML document XSLT Processor Output XML document

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides49 XSL markup Everything in the body of the document that is not XSL markup is template data Example XSL document HelloWorld.xsl

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides50 XSL  Input XML document HelloWorld.xml :  Output XML document:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides51 XSL

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides52 XSL

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides53 XPath  XPath operates on a tree representation of an XML document Similar to DOM tree in that nodes have different types (element, text, comment, etc.) Unlike DOM, attributes are also nodes in the XPath tree Root of XPath tree called document root One of the children of the document root, called the document element, is the root element of the XML document

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides54 XPath  Location path: expression representing one or more XPath tree nodes / represents document root child::message is an example of a location step and has two parts: Axis name Node test

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides55 XPath Attribute nodes are only seen along the attribute axis XSLT specifies context node

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides56 XPath  Node test: Name test: qualified name representing an element (or attribute, for attribute axis) type Example: child::message uses a name test May use * as wildcard name test Node-type test: text() : true if node is a text node comment() : true if node is a comment node node() : true of any node

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides57 XPath  A location step can have one or more predicates that act as filters: This predicate applied first

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides58 XPath

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides59 XPath  Abbreviations: Axis defaults to child if not specified child::para = can be used in place of attribute:: attribute::display parent::node() =.. self::node() =.

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides60 XPath  A location path is one or more location steps separated by / Ex: child::para/child::strong (or just para/strong ) Ex: para/strong/emph

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides61 XPath  Evaluating a two-step location path: Evaluate first location step, producing node list L 1 For each node n i in L 1 Temporarily set context node to n i Evaluate second location step, producing node list L i Result is union of L i s  Continue process for paths with more steps

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides62 XPath  If body is context node, then: para/strong represents { s1, s2, s4 } para[strong] represents { p1, p3 }

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides63 XPath  An absolute location path begins with / and uses the document root as the context node Ex: /body/para represents all para nodes that are children of body which is child of document root Ex: / represents list consisting only of the document root  A relative location path does not begin with / and uses an element determined by the application (e.g., XSLT) as the context node Ex: body/para

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides64 XPath  Another abbreviation: /descendant-or-self::node()/ = // Examples: //strong : All strong elements in document.//strong : All strong elements that are descendants (or self) relative to the context node

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides65 XPath  Combining node lists: Use | to represent union of node lists produced by individual location paths Ex: strong|descendant::emph represents all nodes that are either children of the context node of type strong ; or descendants of the context node of type emph

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides66 XSLT Template rule Pattern of template rule Template of template rule

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides67 XSLT  XSLT processor deals with three XPath trees: Input trees: source and style-sheet Elements containing only white space are normally not included in either input tree (exception: xsl:text element) White space retained within other elements Output tree: result

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides68 XSLT  XSLT processing (high level): Construct input trees Initialize empty result tree Search source tree for a node that is matched by a template rule, i.e., a node that is contained in the node list represented by the pattern of some template rule Instantiate the template of the matching template rule in the result tree Context node for XPath expressions is matched node

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides69 XSLT Matches source tree document root Context node for relative location path is source tree document root

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides70 XSLT

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides71 XSLT  Restrictions on XPath in template rule pattern (value of match attribute): Only child and attribute axes are allowed directly (can indirectly use descendant-or- self axis via // notation) XPath expression must evaluate to a node list (some XPath expressions are functions that produce string values)

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides72 XSLT …

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides73 XSLT

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides74 XSLT

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides75 XSLT

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides76 XSLT  Adding attributes:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides77 XSLT Source document elements are in a namespace We want to copy all h1 elements plus all of their descendants

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides78 XSLT XPath expressions must use qualified names (because source includes namespace) Copy element and content

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides79 XSLT  Template markup in the result tree becomes Most browsers will not accept this notation!  XSLT does not recognize  Solution:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides80 XSLT  Adding XML special characters to the result Template: Result:  disable-output-escaping also applies to value-of Becomes & on input

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides81 XSLT  Output formatting: Add xml:space=“preserve” to transform element of template to retain white space Use xsl:output element:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides82 XML and Browsers  An XML document can contain a processing instruction telling a browser to: Apply XSLT to create an XHTML document:

Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides83 XML and Browsers  An XML document can contain a processing instruction telling a browser to: Apply CSS to style the XML document: