Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 451: XSL Dr. Ralph Westfall February, 2009. Problems With XML no formatting capabilities contra formatting tags like, etc. in HTML CSS can be used.

Similar presentations


Presentation on theme: "CIS 451: XSL Dr. Ralph Westfall February, 2009. Problems With XML no formatting capabilities contra formatting tags like, etc. in HTML CSS can be used."— Presentation transcript:

1 CIS 451: XSL Dr. Ralph Westfall February, 2009

2 Problems With XML no formatting capabilities contra formatting tags like, etc. in HTML CSS can be used but not an ideal solution very limited logic and selection capabilities to get parts of content can use JavaScript (see slsrcpt.html and slsrcpt2.html) but it's slow because it's not specialized for XMLslsrcpt.html slsrcpt2.html

3 What Is XSL? eXtensible Stylesheet Language a language for formatting XML output works somewhat like CSS formats HTML XSL = "CSS for XML" works with Internet Explorer, FireFox, etc.

4 XSL Has Three Components XSLT for transforming XML documents XPath for navigating XML documents XS-FO for formatting XML documents

5 What Is XSLT? XSL Transformations most important component of XSL W3C has made 1.0 version a formal standard (2.0 pending) transforms XML documents into HTML documents, other XML documents, etc. uses XPath to navigate XML documents can be used without other XSL components

6 With XSLT You Can … can add or remove XML elements from an output file element = [some data] rearrange and/or sort elements can use code logic to decide which to add, remove, rearrange, etc.

7 Original File: books.xml Beginning UML Dr. Stumpf 31424321

8 Formatting With books.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

9 XSL Syntax first 3 lines of.xsl file are required overhead use exactly the same spacing and capitalizations <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform>

10 XSL Syntax - 2 match attribute of xsl template element tells how much of.xml file to include match="/" means start with root element (gets whole.xml file) there is a syntax for other match values to get specific (combinations of) data

11 XSL Syntax - 3 XSLT file can contain HTML code bulleted list tags below get their contents from data for title and author in xml file

12 XSL Syntax - 4 xsl value-of element can use its select operator to pull contents of an XML tag into the HTML page gets contents of following title element Beginning UML

13 XSL Syntax - 5 xsl for-each operator is like a for… each loop in VB.NET pulls contents of a set of tags into output retrieves all titles and authors in textbooks sub-elements of books element

14 Exercise work through some of the items in the W3Schools XSLT TutorialXSLT Tutorial XSLT Templates XSLT Element XSLT Element XSLT Element XSLT Element XSLT Element XSLT Element XSLT Templates XSLT Element

15 Exercise try W3Schools XML ExamplesXML Examples XML and XSL are toward bottom of screen note use of HTML div and span tags to implement CSS formats note that some examples have an Edit the text and click me button often the last item under a heading e.g., XML Parser: Loading same file into HTML

16 References much of the content of this PowerPoint was derived from W3Schools XML TutorialXML Tutorial also see XSLT Elements Reference by W3SchoolsXSLT Elements Reference


Download ppt "CIS 451: XSL Dr. Ralph Westfall February, 2009. Problems With XML no formatting capabilities contra formatting tags like, etc. in HTML CSS can be used."

Similar presentations


Ads by Google