1 Dr Alexiei Dingli XML Technologies X-Languages.

Slides:



Advertisements
Similar presentations
XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
Advertisements

Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: XPath, NameSpaces.
Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: C2.
Dr. Alexandra I. Cristea XPath and Namespaces.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
1/18 ITApplications XML Module Session 5: Extensible Stylesheet Language (XSL)
Week 9 Using the Box Properties. 9-2 The CSS Visual Formatting Model Describes how the element content boxes should be displayed by the browser –Based.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
Multi Platform Applications XML, XPath, XSLT transform.
Tutorial 3 Working with Cascading Style Sheets. XP Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
SD2520 Databases using XML and JQuery
Week 0534Styling XML1 Topics CSS – styling XML for screen presentation –Associating CSS with XML –Selectors –Element positioning –Element appearance XSL.
Cascading Style Sheets CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
Cascading Style Sheets Billy Toy Cascading Style Sheets Syntax review How to Implement style sheets Background properties Text properties.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
CIS 375—Web App Dev II XSLFO. 2 XSLFO IntroductionIntroduction XSLFO stands for Extensible Stylesheet Language ___________________. XSLFO is an _____-based.
New Perspectives on XML, 2nd Edition Tutorial 5 1 TUTORIAL 5 WORKING WITH CASCADING STYLE SHEETS.
XP New Perspectives on XML Tutorial 5 1 TUTORIAL 5 CSS Tutorial – Carey ISBN
CSE3201/CSE4500 XPath. 2 XPath A locator for elements or attributes in an XML document. XPath expression gives direction.
Xpath Xlink Xpointer Xquery Sources:
1/17 ITApplications XML Module Session 7: Introduction to XPath.
IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy.
CSE3201/CSE4500 Information Retrieval Systems
XPath XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
WORKING WITH XSLT AND XPATH
1 XPath XPath became a W3C Recommendation 16. November 1999 XPath is a language for finding information in an XML document XPath is used to navigate through.
Session II Chapter 2 – Chapter 2 – XSLhttp://
Tutorial 3 Working with Cascading Style Sheets (CSS)
Sheet 1XML Technology in E-Commerce 2001Lecture 7 XML Technology in E-Commerce Lecture 7 XSL Formatting Objects, Java Data Binding.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
XPath Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 10: A Deeper Look at CCS- Spring 2011.
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 "
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
1 Displaying XML Document Web and Database Management System.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
Advanced Selenium.  XPath is used to navigate through elements and attributes in a document.  XPath includes over 100 built-in functions.  Functions.
XPath Presented by Kushan Athukorala. 2 Agenda XPath XPath Terminology Selecting Nodes Predicates.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
Submitted To: Ms. Poonam Saini, Asst. Prof., NITTTR Submitted By: Rohit Handa ME (Modular) CSE 2011 Batch.
Copyright © 2006, Jumail, FSKSM, UTM Slide 1 Cascading Style Sheets (CSS)
More XML XPATH, XSLT CS 431 – February 23, 2005 Carl Lagoze – Cornell University.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
Session II Chapter 3 – Chapter 3 – XPath Patterns & Expressions Chapter 4 – XPath Functions Chapter 15 – XPath 2.0http://
IS432 Semi-Structured Data Lecture 4: XPath Dr. Gamal Al-Shorbagy.
CSE3201/CSE4500 XPath. 2 XPath A locator for items in XML document. XPath expression gives direction of navigation.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
Advanced Objects. Agenda 2 Working with Websites & Applications ScriptOnce Helpful XPath Tips.
1 XPath. 2 Agenda XPath Introduction XPath Nodes XPath Syntax XPath Operators XPath Q&A.
CSS Box Model. What is the Box Model? Each XHTML element appearing on our page takes up a "box" or "container" of space. Each box size is affected not.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
CH 12 CSS Style Sheets 1. Objective What is CSS? Selecting elements Different rules for different media Importing style sheets 2.
CITA 330 Section 5 XPath. XSL XSL (Extensible Stylesheet Language) is the standard language for writing stylesheets to transform XML documents among different.
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.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
XML. 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.
Chapter 3 Designing Your Web Pages. Objectives What is CSS and Why it is needed How CSS looks and how to write it The different ways to add CSS code to.
XML and XPath.
Presentation transcript:

1 Dr Alexiei Dingli XML Technologies X-Languages

2 X Link X Pointer X Path X Query (Brief) X Form (Brief) XSLT FO Contents

3 X Languages X Query XPointer XLink X Path XSLT

4 Standard way of defining hyperlinks in XML Short for XML Linking Similar to HTML Links but more powerful Any element can have an XLink X Link

5 In HTML we use the tag In XML all tags can have a link <homepage xlink:type="simple" xlink:href=" University of Malta X Link Syntax

6 Declare the namespace in the top element Define a simple element i.e. Go from the current position to that address. Multidirectional are not supported by most browsers. xlink:type="simple" xlink:href=" To define whether to use the current window or a new one... xlink:show="new" X Link Explanation

7 XLink gets more interesting when we want to access remote locations as resources, instead of standalone pages The value of the xlink:show attribute could have been set to "embed". This means that the resource should be processed inline within the page With XLink, you can also specify WHEN the resource should appear –xlink:actuate="onLoad" specifies that the resource should be loaded and shown when the document loads –xlink:actuate="onRequest" means that the resource is not read or shown before the link is clicked. This is very handy for low-bandwidth settings Advanced X Links

8 XML Pointer Language Allow hyperlinks to point to specific parts of an XML document Uses XPath for navigation X Pointer

9 If a hyperlink points to an XML document we can add an XPointer after the URL href=" Find the element with unique Id rock Point to the 5 th item in the list X Pointer Example

10 href=" Is equivalent to href=" X Pointer Short Hand

11 Lies at the heart of the XML technologies Is a syntax for defining parts of document Uses path expressions to navigate Contains a library of standard function (over 100) Major element of XSLT X Path

12 Element Attribute Text Namespace Processing-instruction ( ) Comment Root node X Path Nodes

13 Parent Children Siblings Ancestors Descendants Node relationships

14 Harry Potter Learning XML Example

15 ExpressionDescription nodenameSelects all child nodes of the named node /Selects from the root node //Selects nodes in the document from the current node that match the selection no matter where they are.Selects the current node..Selects the parent of the current attributes Usage

16 Path ExpressionResult bookstoreSelects all the child nodes of the bookstore element /bookstoreSelects the root element bookstore Note: If the path starts with a slash ( / ) it always represents an absolute path to an element! bookstore/bookSelects all book elements that are children of bookstore //bookSelects all book elements no matter where they are in the document bookstore//bookSelects all book elements that are descendant of the bookstore element, no matter where they are under the bookstore element all attributes that are named lang Examples

17 Path ExpressionResult /bookstore/book[1]Selects the first book element that is the child of the bookstore element.Note: IE5 and later has implemented that [0] should be the first node, but according to the W3C standard it should have been [1]!! /bookstore/book[last()]Selects the last book element that is the child of the bookstore element /bookstore/book[last()-1]Selects the last but one book element that is the child of the bookstore element /bookstore/book[position()<3]Selects the first two book elements that are children of the bookstore element all the title elements that have an attribute named lang all the title elements that have an attribute named lang with a value of 'eng' /bookstore/book[price>35.00]Selects all the book elements of the bookstore element that have a price element with a value greater than /bookstore/book[price>35.00]/titleSelects all the title elements of the book elements of the bookstore element that have a price element with a value greater than Example predicates

18 WildcardDescription *Matches any element any attribute node node()Matches any node of any kind Using Wildcards Path ExpressionResult /bookstore/*Selects all the child nodes of the bookstore element //*Selects all elements in the document all title elements which have any attribute

19 Path ExpressionResult //book/title | //book/priceSelects all the title AND price elements of all book elements //title | //priceSelects all the title AND price elements in the document /bookstore/book/title | //priceSelects all the title elements of the book element of the bookstore element AND all the price elements in the document Selecting several paths

20 AxisNameResult ancestorSelects all ancestors (parent, grandparent, etc.) of the current node ancestor-or-selfSelects all ancestors (parent, grandparent, etc.) of the current node and the current node itself attributeSelects all attributes of the current node childSelects all children of the current node descendantSelects all descendants (children, grandchildren, etc.) of the current node descendant-or-selfSelects all descendants (children, grandchildren, etc.) of the current node and the current node itself followingSelects everything in the document after the closing tag of the current node following-siblingSelects all siblings after the current node namespaceSelects all namespace nodes of the current node parentSelects the parent of the current node precedingSelects everything in the document that is before the start tag of the current node preceding-siblingSelects all siblings before the current node selfSelects the current node Axes

21 an axis (defines the tree-relationship between the selected nodes and the current node) a node-test (identifies a node within an axis) zero or more predicates (to further refine the selected node-set) axisname::nodetest[predicate] Location step

22 ExampleResult child::bookSelects all book nodes that are children of the current node attribute::langSelects the lang attribute of the current node child::*Selects all children of the current node attribute::*Selects all attributes of the current node child::text()Selects all text child nodes of the current node child::node()Selects all child nodes of the current node descendant::bookSelects all book descendants of the current node ancestor::bookSelects all book ancestors of the current node ancestor-or-self::bookSelects all book ancestors of the current node - and the current as well if it is a book node child::*/child::priceSelects all price grandchildren of the current node Location step example

23 An absolute location path: /step/step/... A relative location path: step/step/... The difference is the initial / Absolute vrs Relative

24 OperatorDescriptionExampleReturn value |Computes two node-sets//book | //cdReturns a node-set with all book and cd elements +Addition Subtraction *Multiplication6 * 424 divDivision8 div 42 =Equalprice=9.80true if price is 9.80 false if price is 9.90 !=Not equalprice!=9.80true if price is 9.90 false if price is 9.80 <Less thanprice<9.80true if price is 9.00 false if price is 9.80 <=Less than or equal toprice<=9.80true if price is 9.00 false if price is 9.90 >Greater thanprice>9.80true if price is 9.90 false if price is 9.80 >=Greater than or equal toprice>=9.80true if price is 9.90 false if price is 9.70 or price=9.80 or price=9.70true if price is 9.80 false if price is 9.50 and price>9.00 and price<9.90true if price is 9.80 false if price is 8.50 modModulus (division remainder)5 mod 21

25 xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("books.xml"); xpath="/bookstore/book[1]/title"; xmlDoc.selectNodes(xpath); Programming example

26 Designed to query XML Data Like SQL for databases Built on XPath X Query

27 doc("books.xml")/bookstore/book/title Load the document and use XPath to get the data For more powerful queries use FLWOR expressions XQuery Example

28 Similar to HTML forms but defined in XML Richer and more flexible Platform and device independent Standard in XHTML 2.0 X Forms

29 X Forms Example

30 The form The XML The Text X Forms Result

31 XML Stylesheet Language Consist of three parts –XSLT –Xpath –XSL-FO XSL

32 XSL Transformations Transforms XML to another XML document Uses XPath to navigate Most important part of XSL Supported by most browsers XSLT

33 Add Remove Sort Rearrange Perform Tests Make decisions Hide Etc... Power

34 Use XPath to define elements of source When a match occurs –Transform the matching part into the resulting document Workings

35 CD Catalogue (XML) CD Catalogue (XSL) CD Catalogue (XML + XSL) Combined by adding the following line in the XML document Example

36 Declaration part of a Stylesheet

37 XSL style sheet made up of different rules called templates The Match attribute is used to associate a template to an element in the XML document

38 Simple Template 1

39 Simple Template 1 Result

40 Simple Template 2

41 Simple Template 2 Result

42 Simple Template 3

43 Simple Template 3 Result

44 Simple Template 4

45 Simple Template 4 Result

46 Simple Template 5

47 Simple Template 5 Result

48 Simple Template 6

49 Simple Template 6 Result

50 Simple Template 7

51 Simple Template 7 Result

52 Simple Template 8

53 Simple Template 8 Result

54 Script to transform using Java Script and XSLTScript to transform using Java Script and XSLT From the Client Side

55 <% 'Load XML set xml = Server.CreateObject("Microsoft.XMLDOM") xml.async = false xml.load(Server.MapPath("cdcatalog.xml")) 'Load XSL set xsl = Server.CreateObject("Microsoft.XMLDOM") xsl.async = false xsl.load(Server.MapPath("cdcatalog.xsl")) 'Transform file Response.Write(xml.transformNode(xsl)) %> From the Server Side (ASP)

56 Language for formatting XML objects Can output to screen, paper and other media XML files with output information (layout and content) Normally stored in.fo,.fob or even.xml Formatting Objects

57 Example FO

58 < Root ^ Namespace < One or more page template < Page content Explanation

59 Pages (Contain many regions) Regions (Contain Block Areas) Block Areas (Contain Line Areas) Line Areas (Contain Inline Areas) Inline Areas Areas

60 region-body (the body of the page) region-before (the header of the page) region-after (the footer of the page) region-start (the left sidebar) region-end (the right sidebar) Regions

61 Page Regions

62 Page Example

63 Blocks flow into pages Flow

64 xsl-region-body (into the region-body) xsl-region-before (into the region-before) xsl-region-after (into the region-after) xsl-region-start (into the region-start) xsl-region-end (into the region-end) Where to flow?

65 Block Area

66 Block Example

67 Block Attributes (1) Block Margin –margin –margin-top –margin-bottom –margin-left –margin-right Border style attributes –border-style –border-before-style –border-after-style –border-start-style –border-end-style –border-top-style (same as border- before) –border-bottom-style (same as border- after) –border-left-style (same as border-start) –border-right-style (same as border-end) Border color attributes –border-color –border-before-color –border-after-color –border-start-color –border-end-color –border-top-color (same as border-before) –border-bottom-color (same as border-after) –border-left-color (same as border-start) –border-right-color (same as border-end) Border width attributes –border-width –border-before-width –border-after-width –border-start-width –border-end-width –border-top-width (same as border-before) –border-bottom-width (same as border-after) –border-left-width (same as border-start) –border-right-width (same as border-end)

68 Block Attributes (2) Block Padding –padding –padding-before –padding-after –padding-start –padding-end –padding-top (same as padding-before) –padding-bottom (same as padding-after) –padding-left (same as padding-start) –padding-right (same as padding-end) Block Background –background-color –background-image –background-repeat –background-attachment (scroll or fixed) Font attributes –font-family –font-weight –font-style –font-size –font-variant Text attributes –text-align –text-align-last –text-indent –start-indent –end-indent –wrap-option (defines word wrap) –break-before (defines page breaks) –break-after (defines page breaks) –reference-orientation (defines text rotation in 90" increments)

69 Attribute Example

70 Attribute Result

71 Lists

72 Tables

73 XSLT + FO Content Transforming using XSLT+FO

74 To use a.fo to generate a document in any other format use: –Apache FO processor Software Hint

75 Questions?