Presentation is loading. Please wait.

Presentation is loading. Please wait.

INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.

Similar presentations


Presentation on theme: "INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg."— Presentation transcript:

1 INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg

2 Breeze https://breeze.psu.edu/gjy –Input PSU Access ID –Feel free to enter the “room” anytime Download prompted software; it only takes a minute With a camera: –start camera –talk into the microphone Without a camera, feel free to join in using the “chat” pod!

3 XML Reviewed.

4 Element: Building Block of XML Each element has a name and content Each element has a start and end tag XML does NOT define elements Example:

5 XML Environment

6 Attributes Another XML Building Block –Adds richer metadata to elements –Information to help describe an XML element –Contained in the element tag

7 More about XML Example:  Name/value pair  Value is bounded by quotes

8 . …………………... class = …………………………….. Attribute:

9 Example from PortfolioProject gjy1@psu.edu Gayle J Yaverbaum

10 Comments Example

11 References that are immediately replaced by the character they represent. Predefined e.g. < > (as in HTML) 50 < 100 Programmer defined entities (to be demonstrated later) Predefined Entities Example

12 Parsing with XSLT XML Stylesheet Language Transformation

13 Review of Course Software  Sun Java (jdk1.5.0_01 or above) Saxon will not work with earlier versions of JAVA. Java will need environment variables adjusted for the directories in which you placed JAVA JAVA_HOMEc:/JDK1.5.0_ CLASSPATH c:/jdk1.5.0_01/lib; c:/jdk1.5.0_01/bin  Eclipse 3.2. Write xml and xsl files (and others). Produce and test JAVA code. See Eclipse instructions. Install AFTER Java

14 Saxon  Download Saxon fromSaxon http://saxon.sourceforge.net/ Select the open source and freeware version: i.e. Saxon-B 8.8 Select the download for JAVA (saxon will use XML parser supplied with the Java VM. Unzip files into a suitable directory. eg saxon8

15 Saxon Saxon Environment Variables( adjust for directory in which you place SAXON: C:\saxon8\saxon8.jar; C:\saxon8\saxon8-jdom.jar; C:\saxon8\saxon8-xom.jar; C:\saxon8\saxon8-sql.jar

16 XYZXYZ XSLT Processor (saxon) aa Y bb X aa Z bb W cc How It Works! Result: HTML Page Data/Information Transformation of XML to a different format.

17 Transforming XML to XHTML Format SAXON 8.n XSLT implements the XSLT 2.0 and XPath 1.0 recommendations from the World Wide Web Consortium Referred to collectively as "XSLT"Saxon parser

18 XSL Stylesheets Must contain “attribute version” (2.0) Must include xmlms:xsl –Is a namespace declaration. –value of xmlns:xsl is always "http://www.w3.org/1999/XSL/Transform"

19 Template Each xsl:template element must contain either match or name attribute Match templates are the basic building block of xsl Name templates are associated with reuse of code (later)

20 XSL: Extensible Stylesheet Language XSL transforms documents to XHTML Specifies how the data should be rendered

21 XML (from last week’s lab)

22 VIRTUAL PORTFOLIO Used to convey to others the skill level of the person who is maintaining the portfolio. Artists typically demonstrate skills via a portfolio. Relevant here because skills are mastered throughout the semester. Output is a measure of skill level. The objective of a portfolio is to track, evaluate, and improve performance by providing work examples.

23 An electronic portfolio is: [1] * a collection of authentic and diverse evidence, * drawn from a larger archive representing what a person or organization has learned over time * on which the person or organization has reflected, and * designed for presentation to one or more audiences for a articular rhetorical purpose. http://electronicportfolios.org/systems/paradigms.html [1] Barrett, H., Wilkerson, J. (2004), Conflicting Paradigms in Electronic Portfolio Approaches Choosing an Electronic Portfolio Strategy that Matches your Conceptual Framework

24 INFSY 547 PORTFOLIO A collection of work that an individual completes this semester. Private WEB space (PASS) rather than paper output. Portfolio becomes an evolutionary development of all work Using your virtual drive Available when you log on to any PSU machine See PASS on syllabus resources for further information about how to access your personal space. http://aset.its.psu.edu/accounts/personal.html Form to Open PASS Space

25 Sample XML (for discussion purposes) XML.jpg https://portfolio.du.edu/pc/port.detail?id=33150 The Structure of a Portfolio gjy1@psu.edu Gayle J Yaverbaum

26 XSLT Documents Explained! XSLT Documents: Differentiated by a root element, called stylesheet. <xsl:stylesheet version = “2.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> Each template describes how to transform the data elements. Uses one or more templates or instructions

27 TEMPLATES An XSLT document is an XML document Has a root element of stylesheet The stylesheet namespace is: http://www.w3.org/1999/XSL/Transform

28 Explanation: Root template.  The “/” is a pattern that matches root  The xsl: indicates a “namespace” and is essential here to distinguish XSLT from non XSLT elements.

29 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40" version="2.0"> Projects <link rel="stylesheet" type="text/css“ href="PortfolioProject.css" /> INFSY 547 XSLT

30 Templates Matches the document root node Matches any element nodes Applies templates to child nodes <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40" version="2.0">

31 The Process 1.Parser will always look for the root of the XML document 2.Typically will be: 3. Each template has a match attribute.

32 XSL  A very special XLST Instruction (xsl:apply-templates)  Identifies the node-set  Will match all child nodes to templates

33 Patterns Templates contain patterns Patterns match elements. Patterns define a condition that a node may or may not satisfy Whenever you have a beginning template, you will need an ending eg element

34 .

35 “/” Symbol ■ Use the “/” symbol to match specific hierarchies ■ Use the “/” to specify deeper matches also ■ Use // slash to select deeper levels

36 for-each ■ Processes each element chosen by its select attribute in turn ■ The “/” after title is a short form

37 Matching attributes ■ The “@” selects nodes based upon attribute names. ■ Assume an attribute “lang” associated with every book in a bookstore file

38 Sorting Output Elements Assume an AUTHOR element with two children: Arch Frank To Sort and display by LAST: any other code for group Or ascending

39 Images XML File XML.jpg

40 Images XSL File

41 Batch File to Run Processor java net.sf.saxon.Transform bookstore.xml bookstore.xsl > bookstore.html pause

42 Lab Assignment Copy the bookstore.xml from my Web space into an Eclipse General Project called BookStore bookstore.xml Create the.xsl file to present bookstore.xml –Only list the books that are in English – Create a 2 column table to display the book title and the price Link this lab into your portfolio. Recommended is a lab section. –.xml –.xsl –.html –.bat

43 Harry Potter 29.99 Learning XML 39.95 French History 89.99


Download ppt "INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg."

Similar presentations


Ads by Google