Advanced XSL Learn how to use advanced XSLT techniques, EXSLT, and Xalan extensions to solve complicated problems. 2008 Cascade Server User’s ConferenceAmy.

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

Chungnam National University DataBase System Lab
3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp Title text for Title or Divider.
Copyright 2001, ActiveState. XSLT and Scripting Languages or…XSLT: what is everyone so hot and bothered about?
Transforming XML XMLNamespaces, XSLT. XML Namespaces Sometimes it is necessary to mix XML elements –Different types of content –Use of markup to convey.
Advanced XSLT II. Iteration in XSLT we sometimes wish to apply the same transform to a set of nodes we iterate through a node set the node set is defined.
Advanced XSLT. Branching in XSLT XSLT is functional programming –The program evaluates a function –The function transforms one structure into another.
Advanced XSLT II. Iteration in XSLT we sometimes wish to apply the same transform to a set of nodes we iterate through a node set the node set is defined.
DOCUMENT TYPES. Digital Documents Converting documents to an electronic format will preserve those documents, but how would such a process be organized?
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK) Lecture 12 Extensible Stylesheet Language Transformations : XSLT.
©CSW Group Ltd 2005 Intermediate XSLT Bob DuCharme these slides: 1.0.
 2001 Prentice Hall, Inc. All rights reserved. 1.
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.
Developing Interfaces and Interactivity for DSpace with Manakin Part 5: Introduction to Manakin’s Theme Tier Eric Luhrs Digital Initiatives Librarian,
XML 6.2 XSL / XSLT 6. What is XSL? XSL stands for eXtensible Stylesheet Language CSS was designed for styling HTML pages, and can be used to style XML.
XSL XSLT and XPath 11-Apr-17.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
XML Unit 6 October 31. XML, review XML is used to markup data Used to describe information Uses tags like HTML –But all tags are user-defined –Must be.
XSLT eXtensible Stylesheet Language Transformations Naveed Arshad.
XML Study-Session: Part IV Transforming XML Documents Copyright Quddus Chong 2001.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
We Need Smart XML Processing HTML has ultra-complex semantics XML has no semantics Something must bridge the gap  A program ?  A clear set of data semantics?
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Understanding Page Template Components Lila Bronson Training Manager, OmniUpdate, Inc.
Philadelphia Area SharePoint User Group Using XSLT with Custom Web Parts Rick Wise RJB Technical Consulting
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
JSP Standard Tag Library
15 November 2005Linking Outside the Box1 Cross referencing between XML documents Bob Stayton Sagehill Enterprises
5/5/2005Toni Räikkönen Internet based data collection from enterprises using XML questionnaires and XCola engine CoRD Meeting May 11th 2005.
SDPL 2002Notes 7: Apache Cocoon1 7 XML Web Site Architecture Example: Apache Cocoon, a Web publishing architecture based on XML technology
Introduction technology XSL. 04/11/2005 Script of the presentation Introduction the XSL The XSL standard Tools for edition of codes XSL Necessary resources.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
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
XP New Perspectives on XML, 2 nd Edition Tutorial 10 1 WORKING WITH THE DOCUMENT OBJECT MODEL TUTORIAL 10.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
Implementing Forms and Form Renderers in the Open Source Portfolio David McPherson, Chris Maurer Will Trillich, Janice Smith Materials by Sean Keesler.
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 34 - Case Study: Active Server Pages and XML Outline 34.1 Introduction 34.2 Setup and Message.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
ECA 228 Internet/Intranet Design I XSLT Example. ECA 228 Internet/Intranet Design I 2 CSS Limitations cannot modify content cannot insert additional text.
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
The Information School at the University of Washington INFO 440: Information System Design Fall 2003 * Bob Boiko * MSIM Associate Chair XML Transforms.
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Transforming Documents „a how-to of transforming xml documents“ Lecture on Walter Kriha.
Presentation Topic: XML and ASP Presented by Yanzhi Zhang.
March 28, 2001XSP Session O’Reilly Enterprise Java Conference 1 XSP Session Sue Spielman President/Consulting Engineer President/Consulting Engineer
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Applying eXtensible Style Sheets (XSL) Ellen Pearlman Eileen Mullin Programming.
1 Overview of XSL. 2 Outline We will use Roger Costello’s tutorial The purpose of this presentation is  To give a quick overview of XSL  To describe.
CS1001 Lecture 9. Overview Security Security HTML HTML.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
AxKit A member of the Apache XML project Ryan Maslyn Kyle Bechtel.
More XML XPATH, XSLT CS 431 – February 23, 2005 Carl Lagoze – Cornell University.
XP New Perspectives on XML, 2 nd Edition Tutorial 7 1 TUTORIAL 7 CREATING A COMPUTATIONAL STYLESHEET.
2011 Calendar Important Dates/Events/Homework. SunSatFriThursWedTuesMon January
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
Making Pages Dynamic Chapter 8 JavaScript for the WWW.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Chapter 13 A & B Programming Languages and the.
XML Schema – XSLT Week 8 Web site:
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
Apache Cocoon – XML Publishing Framework 데이터베이스 연구실 박사 1 학기 이 세영.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
Unit 4 Representing Web Data: XML
Chapter 7 Representing Web Data: XML
2015 January February March April May June July August September
Presentation transcript:

Advanced XSL Learn how to use advanced XSLT techniques, EXSLT, and Xalan extensions to solve complicated problems Cascade Server User’s ConferenceAmy Liu & Brett Goodwin

Agenda XSL & XSLT XSLT Warmup Muenchian Method EXSLT Xalan Extensions Velocity Script Formats 09/22/2008Amy Liu & Brett Goodwin

XSL & XSLT XSL (eXtensible Stylesheet Language) consists of three parts: – XSLT a language for transforming XML documents – XPath a language for navigating in XML documents – XSL:FO a language for formatting XML documents 09/22/2008Amy Liu & Brett Goodwin

XSLT Warmup 09/22/2008Amy Liu & Brett Goodwin

Using { } in place of index / index 09/22/2008Amy Liu & Brett Goodwin

Problem #1: Categorical Grouping… Example Scenario: You have categorized a set of pages within Cascade Server by utilizing Custom Metadata checkboxes. Now, you would like to create a listing of all the categories along with the list of pages that belong to each category in alphabetical order for display on a “Campus Resources” page. 09/22/2008Amy Liu & Brett Goodwin [01grouping.xml]

1 st Attempt: Easy-&-High-Maintenance Method Campus Resources Alumni Current Students Prospective Students Visitors 09/22/2008Amy Liu & Brett Goodwin [02grouping-attempt.xsl]

Muenchian Method! Campus Resources 09/22/2008Amy Liu & Brett Goodwin [03muenchian.xsl]

Problem #2: Truncating Content… Example Scenario: Your users are now familiar with Cascade and have created several blog posts within the system. You would like to set up some sort of landing page that features the latest blog posts. 09/22/2008Amy Liu & Brett Goodwin [04recent-blogs.xml]

1 st Option: List 3 Latest Posts + Full Content 09/22/2008Amy Liu & Brett Goodwin [05full-listing.xsl]

2 nd Option: Truncate using Character Count... More... 09/22/2008Amy Liu & Brett Goodwin [06truncate-charcount.xsl]

3 rd Option: Truncate after Whole Words … More... … … … … … 09/22/2008Amy Liu & Brett Goodwin [07truncate-wordcount.xsl] 7 Templates 382 Lines 15,167 Characters 7 Templates 382 Lines 15,167 Characters

EXSLT Although XSLT lacks features like loops and mutable variables, it is considered Turing-complete, meaning that given sufficient memory, XSLT can perform any calculation that can be performed by a modern computer program. However, this theoretical ability is often impractical.Turing-complete EXSLT is a community initiative to provide extensions to XSLT 1.0 and to partition them into functional groups that can be implemented on an á la carte basis. The EXSLT effort is an open one; anyone who wishes to contribute may do so. Many of the functions in EXSLT are simply shortcuts to equivalent behaviors that can be achieved using XSLT templates. For these functions, the EXSLT authors have provided XSLT templates that may be imported into existing style sheets. This approach offers the most portability, as all XSLT 1.0-compliant processors are able to correctly interpret the template and provide the functionality. 09/22/2008Amy Liu & Brett Goodwin

3 rd Option: Truncate using str:tokenize()... More... 09/22/2008Amy Liu & Brett Goodwin [08exslt-tokenizer.xsl] <xsl:stylesheet version=“1.0” xmlns:xsl=“ xmlns:str=“ extension-element-prefixes=“str” > Be sure to specify the extension namespace URI & use the extension-element-prefix!

Problem #3: Formatting Date & Time… Example Scenario: Now that you have successfully truncated your blog posts, the next item to tackle is to format and display the date/time that is associated with each post. As you probably know, all date values within Cascade are represented in UNIX timestamp format (i.e., ). 09/22/2008Amy Liu & Brett Goodwin [04recent-blogs.xml]

Problem #3: Formatting Date & Time… If you were to attempt this calculation using only native XSLT 1.0, it will probably take about 304 lines or 10,345 characters. The EXSLT Dates-and-Times functions don’t have anything readily available for use with UNIX timestamps. Any other options? 09/22/2008Amy Liu & Brett Goodwin

That’s right! Xalan Extensions Xalan is the XSLT processor that Cascade Server utilizes. For those situations where you would like to augment the functionality of XSLT with calls to a procedural language, Xalan-Java supports the creation and use of extension elements and extension functions. The Xalan XSLT processor can invoke almost any method in almost any Java™ class in the classpath. Doing so can improve performance, provide features like trigonometric functions that aren't available in XSLT, perform file I/O, talk to databases and network servers, or implement algorithms that are easy to write in the Java language but hard to write in XSLT. Typically, you'll resort to using Xalan extensions when you can't accomplish what you need using the existing XSLT or EXSL functions and need to write your own custom functions in Javascript or Java. 09/22/2008Amy Liu & Brett Goodwin

Xalan Date Converter  ,... function convertMonth(date) { var months = new Array(13); months[0] = "January"; months[1] = "February"; months[2] = "March"; months[3] = "April"; months[4] = "May"; months[5] = "June"; months[6] = "July"; months[7] = "August"; months[8] = "September"; months[9] = "October"; months[10] = "November"; months[11] = "December"; var d = new Date(date); // Splits date into components var month = months[d.getMonth()]; return month; } convertDay(date) {…} convertDate(date) {…} convertYear(date) {…} convertTime(date) {…} 09/22/2008Amy Liu & Brett Goodwin [09xalan-convertdate.xsl]

Velocity! The Non-XSLT Bonus Velocity is a Java-based template engine that Cascade Server will support starting with version 5.7 It can be used to generate web pages, SQL, PostScript and other output from templates Velocity Template Language (VTL) should have a lower learning curve than XSLT for developers who are already familiar with traditional programming languages Utilizing VTL Formats, in some cases, can simplify the transformation code within Cascade 09/22/2008Amy Liu & Brett Goodwin

Context Menu Comparison XSLT Format VTL Format #foreach ($child in $contentRoot.children) $child.getChild(“name”).text #end 09/22/2008Amy Liu & Brett Goodwin

09/22/2008Amy Liu & Brett Goodwin