JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.

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
9 Copyright © 2005, Oracle. All rights reserved. Modularizing JavaServer Pages Development with Tags.
What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
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.
XSLT (eXtensible Stylesheet Language Transformation) 1.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
DT211/3 Internet Application Development
XSL Concepts Lecture 7. XML Display Options What can XSL Transformations do? generation of constant text suppression of content moving text (e.g., exchanging.
XSL Unit 6 November 2. XSL –eXtensible Stylesheet Language –Basically a stylesheet for XML documents XSL has three parts: –XSLT –XPath –XSL-FO.
XML Language Family Detailed Examples Most information contained in these slide comes from: These slides are intended.
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Understanding Page Template Components Lila Bronson Training Manager, OmniUpdate, Inc.
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
JSP Standard Tag Library
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Chapter 16 The World Wide Web. 2 The Web An infrastructure of information combined and the network software used to access it Web page A document that.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XML – Extensible Markup Language XML eXtensible – add to language. Markup – delimit info using tags. Language – a way to express info.
XML for E-commerce III Helena Ahonen-Myka. In this part... n Transforming XML n Traversing XML n Web publishing frameworks.
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
Another PillowTalk Presentation  2004 Dynamic Systems, Inc. Introduction to XML for SOA Lee H. Burstein,
Extensible Markup and Beyond
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 is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
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 "
CIS 375—Web App Dev II XSL. 2 XSL Introduction XSL stands for _____________________________. XSL is the language used for manipulating and displaying.
Presentation Topic: XML and ASP Presented by Yanzhi Zhang.
Utilizing XML in ColdFusion MX by Attila Domokos.
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.
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
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.
JSTL The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.
Jennifer Widom XML Data Introduction, Well-formed XML.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
XML, XSL, and SOAP Building Object Systems from Documents CSC/ECE 591o Summer 2000.
Well Formed XML The basics. A Simple XML Document Smith Alice.
Unit 3 — Advanced Internet Technologies Lesson 11 — Introduction to XSL.
 XSL – Extensible Style Sheet Language  XSLT – XSL Transformations › Used to transform XML documents to other formats,like HTML or other XML documents.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
University of Nottingham School of Computer Science & Information Technology Introduction to XML 2. XSLT Tim Brailsford.
Martin Kruliš by Martin Kruliš (v1.1)1.
1 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Stylesheets CSS:Cascading Style Sheets XSL(T):eXtended Stylesheet Language (Transformations)
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
XML Schema – XSLT Week 8 Web site:
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.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
Lecture Transforming Data: Using Apache Xalan to apply XSLT transformations Marc Dumontier Blueprint Initiative Samuel Lunenfeld Research Institute.
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
1 XSLT XSLT (extensible stylesheet language – transforms ) is another language to process XML documents. Originally intended as a presentation language:
Extensible Markup Language (XML) Pat Morin COMP 2405.
XML: Extensible Markup Language
Unit 4 Representing Web Data: XML
XML in Web Technologies
Knowledge Byte In this section, you will learn about:
Database Processing with XML
Chapter 7 Representing Web Data: XML
XML Data Introduction, Well-formed XML.
More XML XML schema, XPATH, XSLT
Presentation transcript:

JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout

JSP Standard Tag Library (JSTL) JSTL is a standardized set of Custom Tags with several implementations -doc/intro.html -doc/intro.html JSTL is one Tag Library, but it’s functionally is divided into four parts with its own TLD  Core  XML Processing  I18N  Database Access (SQL)

JSTL - Prerequisites In all examples a couple of objects are supposed to be available  customers - A collection of Customer objects  intArray - An array of int's  stringArra - An array of Strings  The Customer Object int key String lastName String firstName Date birthDate Address address  The Address Object String line1 String line2 String city String state String country

JSTL Core The Core part of JSTL contain tags the core of JSTL such as iteration, conditional processing and expression language support at the top of your JSPs

JSTL Core – General tags is used to declare variables and assign values to them  

JSTL Core – General tags is used to print values 

JSTL Core – Conditional tags Conditional tags are used for execution control  </c:if and - a switch/case structure  

JSTL Core – iteration tags Iteration tags are used to loop over some data structure, often a Collection   

JSTL Core – iteration tags   

JSTL Core – Import tags There are several tags for importing information from http and ftp (and more)  Will get the content of the URL and print it  Relative path is ok  Will get the content and store it in the variable resultVar

JSTL Core – Import tags The can be combined with to import content from dynamic sites  

JSTL Core – Working with URLs The and is used together to construct URLs with proper escaping and rewriting   Gives base.jsp?name=Fredrik%20Alund  Possibly with jsessionid appended

JSTL XML JSTL contains several tags for working with XML and XSLT  But first an introduction to XML and XSLT

XML XML is an abbreviation for EXtensible Markup Language A markup language like HTML Not used to generate layouts but to describe data No tags are defined in XML, just syntax rules for tags XML uses a DTD (Document Type Definition) to formally describe the data

XML XML tags are case sensitive All XML elements must have a closing tag  or All XML elements must be properly nested  is not valid All XML documents must have a root/start tag is not valid, but is

XML A XML document is well formed if it conforms to the XML syntax rules A XML document is valid if it is well formed and conform to the rules of a DTD

XML Example 1 Fredrik Ålund 32 The first line tells what version of XML is used and what encoding to use

XML bigger example Fredrik Ålund 32 Annika Ålund 28 Viktor Ålund 0,5

XML attributes XML elements can have attributes Fredrik Ålund Services Helena Larsson Services

XML CDATA If the value of an element contain binary data or some other illegal characters, CDATA can be used 

Why XML? Describe your data Give you a structure of your data Easier integration of systems The same XML document can be transformed to HTML, WML or VoiceXML to support different clients

XSL and XSLT XSL is an abbreviation of eXtensible Stylesheet Language XSLT means XSL Transformation XSL consists of two parts  A method for transforming XML documents A XML document can be transformed into a HTML document  A method for formatting XML documents Elements can be sorted and formatted in different ways XSL files are valid XML documents

A XSL example A XSL to transform our employee list to html might look like Name Department

XSL templates Stylesheets starts with A template matches a part of a XML document and is evaluted  - matches the root  - matches employees

XSL loops over all employees will order the elements on the name element (+ ascending, - descending)

XSL and filters Filters can be applied to filter out elements Valid filter operations are  = (equal)  =! (not equal)  &LT& (less than)  &GT& (greater than)

XSL returns the value of an element or attribute return the value of the name element for the current employee returns the empid attribute of the employee element

XSL IF The conditional statement if is available in XSL 

XSL chose... some code some code....

XSL Text  Used to output text. Useful if the text is not valid XML since it can be combined with

Instead of using for-each, we can use Make for each element Put <xsl:apply-template where you want the output of the other template

In XSL you have to follow XML syntax rules. This makes it hard to construct HTML form elements and HREFs. can be used to ease this A HREF link in XSL Detail

A HTML Form text input field 2 text 1 quantity

The same XSL with apply-template Id Name Department

JSTL and XML, resumed JSTL has support for navigating XML with XPath and to do XSLT processing is used to specify that the XML part is to be used

JSTL XML - parsing A XML structure can be parsed into a XML document that can be navigated foo bar  The XML is parsed into variable a  The value of the element d is selected

JSTL XSL Transformation header!

JSTL XSL Transformation combined with JSTL Core and Custom Tags Combine the Core import with XSLT to read the XSL file from disk Get XML output from a Custom tag (or Java Bean) Do XSL Transformation

JSTL XSL Transformation combined with JSTL Core and Custom Tags