Lecture 5.21 5.2 Transforming Data: Using Apache Xalan to apply XSLT transformations Marc Dumontier Blueprint Initiative Samuel Lunenfeld Research Institute.

Slides:



Advertisements
Similar presentations
Inside an XSLT Processor Michael Kay, ICL 19 May 2000.
Advertisements

9 Copyright © 2005, Oracle. All rights reserved. Modularizing JavaServer Pages Development with Tags.
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.
XML: Extensible Markup Language
Apache Struts Technology
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
XML Study-Session: Part IV Transforming XML Documents Copyright Quddus Chong 2001.
JAXP Transformation Package and Xalan Extensions 黃立昇
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
DT211/3 Internet Application Development
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
Apache Struts Technology A MVC Framework for Java Web Applications.
Technical Track Session XML Techie Tools Tim Bornholt.
Chapter 13 XML Concept of XML Simple Example of XML XML vs. HTML in Syntax XML Structure DTD and CDATA Sections Concept of SAX Processing Download and.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Introduction to XSLT & its use in Grainger Library full-text & metadata projects Thomas G. Habing Grainger Engineering Library Presentation to ASIS&T,
Eclipse is an open source IDE (Integrated Development Environment) for developing applications in Java, C/C++, HTML, Cobol, Perl, etc. The official Eclipse.
UNIT-V The MVC architecture and Struts Framework.
DSpace XML UI Project Texas A&M University Digital Initiatives, Research and Technology Scott Phillips, Cody Green, Alexey Maslov, Adam Mikeal, Brian Surratt,
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
JSP Standard Tag Library
Advanced Java New York University School of Continuing and Professional Studies.
1 Understanding Cocoon2 Pankaj Kumar May 24, 2001 Web Services Organization HPMD, SSO, HP.
JSP Tag Library CSCI 4300 Notes from Steve Small, /jw-0228-jstl.html.
XML and its applications: 4. Processing XML using PHP.
® IBM Software Group © 2007 IBM Corporation JSP Custom Tags
Introduction to Java Server Pages (JSPs) Robert Thornton.
Introduction to J2EE Architecture Portions by Kunal Mehta.
DSpace UI Alexey Maslov. DSpace in general A digital library tool useful for storage, maintenance, and retrieval of digital documents Two types of interaction:
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
JSTL JSP Standard Tag Library 12-Oct-15. W HAT IS JSTL? JSTL (JSP Standard Tag Libraries) is a collection of JSP custom tags developed by Java Community.
1 XSLT An Introduction. 2 XSLT XSLT (extensible Stylesheet Language:Transformations) is a language primarily designed for transforming the structure of.
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
JSTL Lec Umair©2006, All rights reserved JSTL (ni) Acronym of  JavaServer Pages Standard Tag Library JSTL (like JSP) is a specification, not an.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
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.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
JSTL The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Dom and XSLT Dom – document object model DOM – collection of nodes in a tree.
1 Introduction JAXP. Objectives  XML Parser  Parsing and Parsers  JAXP interfaces  Workshops 2.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
Basic JSP Celsina Bignoli Problems with Servlets Servlets contain –request processing, –business logic –response generation all lumped.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
Martin Kruliš by Martin Kruliš (v1.1)1.
©2001 Priority Technologies, Inc. All Rights Reserved Meteor Status Miami Face to Face Meeting January 16 – 18, 2002.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Apache Struts Technology A MVC Framework for Java Web Applications.
Apache Cocoon – XML Publishing Framework 데이터베이스 연구실 박사 1 학기 이 세영.
Java High level programming language ◦ Sun Microsystems ◦ ORACLE acquired Java Development Kit – JDK Java Runtime Environment – JRE Java Virtual Machine.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
XML: Extensible Markup Language
JSP: Actions elements and JSTL
JSP (Java Server Page) JSP is server side technology which is used to create dynamic web pages just like Servlet technology. This is mainly used for implementing.
Using XML Tools CS551 – Fall 2001.
XML in Web Technologies
Knowledge Byte In this section, you will learn about:
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
Database Processing with XML
XML and its applications: 4. Processing XML using PHP
Presentation transcript:

Lecture Transforming Data: Using Apache Xalan to apply XSLT transformations Marc Dumontier Blueprint Initiative Samuel Lunenfeld Research Institute Toronto, ON

Lecture 5.22 Outline Introduction to Apache Xalan. Use the Xalan interactive processor from the command line. Use the Xalan Java API to apply an XSLT transformation. Use the JSP Standard Tag Library to apply transformations

Lecture 5.23 Apache Xalan Fully compliant XSLT 1.0 processor Fully supports XPath 1.0 Includes an Interpretive processor for debugging. Can be configured to work with any W3C compliant XML parser. Optimized for Xerces. Can process stream, SAX, or DOM input. Can output to a stream, SAX, or DOM

Lecture 5.24 Apache Xalan Transformations may be chained. Includes an applet wrapper. May be used in a servlet May be used from JavaServer Pages. Can be extended.

Lecture 5.25 Outline Introduction to Apache Xalan. Use the Xalan interactive processor from the command line. Use the Xalan Java API to apply an XSLT transformation. Use the JSP Standard Tag Library to apply transformations

Lecture 5.26 Applying transformation from the command line Use the interpretive processor for simple command line based transformations. Advantages: –Easier to debug by isolating transformation from a larger more complex system. –Can see output of to console. is used for debugging. Similar to System.out.println(). –Quick to execute –Simple to use

Lecture 5.27 Applying transformations from the command line

Lecture 5.28 Outline Introduction to Apache Xalan. Use the Xalan interactive processor from the command line. Use the Xalan Java API to apply an XSLT transformation. Use the JSP Standard Tag Library to apply transformations

Lecture 5.29 Using the Java API Prerequisites –Must include necessary JAR files in your classpath such as xalan.jar, and an XML parser such as Apache Xerces. –An XML document to transform, either from a file, W3C DOM structure, or string. –A valid XSLT Stylesheet which describes the rules of transformation.

Lecture Using the Java API - Example This program takes in an XML filename, and an XSLT filename, and writes the result of the transformation to standard output. The first step is to get the argument values and convert them to URIs (Uniform Resource Identifiers). The second step involves creating a TransformerFactory object. This object employs the factory pattern. The third step is to create a Transformer object for the XSLT stylesheet. The fourth step is to transform the XML document.

Lecture Using the Java API - Example

Lecture Using the Java API - Example

Lecture Outline Introduction to Apache Xalan. Use the Xalan interactive processor from the command line. Use the Xalan Java API to apply an XSLT transformation. Use the JSP Standard Tag Library to apply transformations

Lecture Using Xalan from JavaServer Pages The common pattern for doing XSLT transformation in Java Server Pages (JSP) is to use the JSP Standard Template Library. It is also possible to import the Xalan classes and embed Java code using the API.

Lecture Introduction to JSTL JavaServer Pages Standard Tag Library (JSTL) encapsulates common JSP functionality into Tags. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and tags for accessing databases using SQL. It also introduces the concept of an expression language to simplify page development.

Lecture JSTL & XML

Lecture Core Tags Provides the basic functionality for accessing and parsing XML data. The parse tag parses an XML file and stores the result in a type of variable. The expr and set tags are for running XPath expressions. set can store the results into a scoped JSP attribute.

Lecture Flow Control Tags Similar to XSLT. Allows for evaluating XPath expressions and creating control statements. for-each allows for iterating over a node-set.

Lecture Transformation Tags Perform XSLT transformations! Optionally pass parameters to the stylesheet such as external information only known as runtime.

Lecture Using Xalan from JavaServer Pages There’s some setup required! There are multiple ways of doing this, use what works. This technology is very new. You must import the tag library definitions. The files must then be mapped in web.xml The supporting JAR files must be in your web application’s classpath (usually WEB-INF/lib).

Lecture Using Xalan from JavaServer Pages

Lecture Using Xalan from JavaServer Pages

Lecture Parsing an XML document Must read in the XML as a string using the core tag import. Use the parse tag on this string variable to parse into a DOM structure.

Lecture Parsing an XML document Parse XML Parse XML demo

Lecture Using XPath in JSTL XPath Demo XPath demo

Lecture Using XPath in JSTL

Lecture Running a Transformation from JSTL Similar to the previous example, reading the XML file from disk is done with the import tag. The transform tag is used to transform the XML using the XSLT that must also be read in and parsed

Lecture Running a Transformation from JSTL

Lecture Running a Transformation from JSTL

Lecture Expression Language (EL) JSP 2.0 introduced Expression Language (EL). EL is used extensively in JSTL. EL expressions are found in the special holder ${ }. Attributes can be accessed through EL. –Example: ${pageContext.request.method} could be equal to ‘GET’ or ‘POST’

Lecture LAB Section The purpose of this lab is to get a working knowledge of using xalan in the three methods described. –Command Line –Java API –JSP/JSTL All Code and examples have been provided

Lecture The Data The Data chosen for this lab is the XML output from apollo: the sequence annotation tool. Apollo is a collaboration between the Drosophila Genome Project, the Sanger Institute and the EBI. GMOD has adopted Apollo for sequence annotation. The XML output generated is GameXML.

Lecture Apollo

Lecture The Source Use CVS to checkout the gamexml module. It includes the following –A build.xml file for ant –2 GameXML files (game.xml, smallgame.xml) –2 XSLT stylesheets (game_transcript.xsl, game_sequence.xsl) –game.dtd (no XML Schema available) –MyTansformer

Lecture Exercises 1.Explore the project 2.Run MyTransformer with an XML file and a XSLT Stylesheet. 3.Install the Web Application into tomcat. 4.Run all the JSPs and see how they work. 5.Write your own JSP with JSTL tags for processing XML.