Using xalan extensions to get the current date and time.

Slides:



Advertisements
Similar presentations
Complete Structure class Date {class Date { private :private : // private data and functions// private data and functions public :public : // public data.
Advertisements

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.
Advanced XSLT. Branching in XSLT XSLT is functional programming –The program evaluates a function –The function transforms one structure into another.
Multimedia Seminar XSLT Tobias Naumann. MM Seminar - XSLT2 Structure What is XSLT? Design and Concepts Practical use Examples.
Arkansas IUG June 18, 2010 Nathan James, MLIS
CSCI 6962: Server-side Design and Programming Input Validation and Error Handling.
Advanced XSL Learn how to use advanced XSLT techniques, EXSLT, and Xalan extensions to solve complicated problems Cascade Server User’s ConferenceAmy.
Technology Reviews :XSL Park, Ho-gun. What is XSL Extensible Style sheet LanguageExtensible Style sheet Language An XML-based language used to.
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.
XSL XSLT and XPath 11-Apr-17.
Introduction to C# Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Chapter 2 Review Questions
XSLT XML DBs, and Schemas Week 18 DSA. The Whisky Case study XSLT can be applied in the client. –Add a xml processing instruction to the xml to bind to.
DSA Semester 2. XML Tagged data Hello A really interesting course, well taught Interchange of data RSS, BPEL4WS, RossettaNet … Structure document representation.
XML Workshop XSLT. XML Tagged data Hello A really interesting course, well taught Interchange of data RSS, BPEL4WS, RossettaNet … Structure document representation.
Internet Technologies XSLT Processing XML using XSLT Using XPath Escaping to Java.
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
XSL Transformations Transforming XML document into other (XML) documents 1XSL Transformations.
17 Apr 2002 XML Stylesheets Andy Clark. What Is It? Extensible Stylesheet Language (XSL) Language for document transformation – Transformation (XSLT)
Technical Track Session XML Techie Tools Tim Bornholt.
More on XSLT. More on XSLT variables Earlier we saw two ways to associate a value with a variable  A variable whose value is the empty string, for example.
XSLT 1. C ONTENTS XSLT and uses XSLT example Simple XML How XSLT works? Template-match Value-of For-each and sort If Choose-when Apply-templates Where.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
JSP Standard Tag Library
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 12.
Use of XSLT Formats in Creation, Maintenance and Optimization of Web Site Templates Jay Mercer IU Communications Indiana University
SDPL 2002Notes 7: Apache Cocoon1 7 XML Web Site Architecture Example: Apache Cocoon, a Web publishing architecture based on XML technology
Comparing XSLT and XQuery Michael Kay XTech 2005.
Chapter 2 Practice.
1 XSLT An Introduction. 2 XSLT XSLT (extensible Stylesheet Language:Transformations) is a language primarily designed for transforming the structure of.
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 "
XSLT part of XSL (Extensible Stylesheet Language) –includes also XPath and XSL Formatting Objects used to transform an XML document into: –another XML.
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 26 Internationalization.
SDPL 2001Notes 7.2: Apache Cocoon1 7.2 Apache Cocoon An example of a Web publishing architecture based on XML technology An.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 23 — Simple Object Access Protocol (SOAP) and Microsoft BizTalk™ Outline 23.1Introduction 23.2Simple.
 2002 Prentice Hall, Inc. All rights reserved. 1 Chapter 12 – XSL: Extensible Stylesheet Language Transformations (XSLT) Outline 12.1Introduction 12.2Setup.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Applying eXtensible Style Sheets (XSL) Ellen Pearlman Eileen Mullin Programming.
JSTL The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.
LDAP API: Searching CNS 4650 Fall 2004 Rev. 2. LDAP Search Create connection Bind (if needed) Perform search Display results Close connection.
Getting Started Java Fundamentals CSC207 – Software Design Summer 2011 – University of Toronto – Department of Computer Science.
May 24, 2004IVOA Interop Meeting1 An AXIS-based Java SkyNode Ramon Williamson NCSA T HE US N ATIONAL V IRTUAL O BSERVATORY.
CIS 270—Application Development II Chapter 8—Classes and Objects: A Deeper Look.
XSLT. XSLT stands for Extensible Stylesheet Language Transformations XSLT is used to transform XML documents into other kinds of documents. XSLT can produce.
Unit 3 — Advanced Internet Technologies Lesson 11 — Introduction to XSL.
University of Nottingham School of Computer Science & Information Technology Introduction to XML 2. XSLT Tim Brailsford.
Recitation 5 Enums and The Java Collections classes/interfaces 1.
1 Chapter 20 Internationalization. 2 Objectives F To describe Java's internationalization features (§ 20.1). F To construct a locale with language, country,
1 XMLXSL(T) and CSS NOEA/PQC (rev. fen) 2007 Stylesheets CSS:Cascading Style Sheets XSL(T):eXtended Stylesheet Language (Transformations)
©2001 Priority Technologies, Inc. All Rights Reserved Meteor Status Miami Face to Face Meeting January 16 – 18, 2002.
Announcements Final Exam: TBD. Static Variables and Methods static means “in class” methods and variables static variable: one per class (not one per.
Enum,Structure and Nullable Types Ashima Wadhwa. Enumerations, Enumerations, or enums, are used to group named constants similar to how they are used.
02/03/ Strings Left, Right and Trim. 202/03/2016 Learning Objectives Explain what the Left, Right and Trim functions do.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 1 Chapter 15 Abstract Classes and Interfaces.
XML Schema – XSLT Week 8 Web site:
Lecture Transforming Data: Using Apache Xalan to apply XSLT transformations Marc Dumontier Blueprint Initiative Samuel Lunenfeld Research Institute.
Clinical Data Exchange using HL7 and Mirth Connect Lecture 12 - Using JavaScript with Mirth Connect – III - Advanced Message Routing - XSLT transforms.
October 19th 2016 Meeting Minutes.
More Sophisticated Behavior
XML in Web Technologies
Factors, multiple, primes: Factors from prime factors
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
Chapter 12 Abstract Classes and Interfaces
Chapter 13 Abstract Classes and Interfaces Part 01
Factors, multiple, primes: Multiples
Standard Form: Multiplying powers of 10
Standard form: In standard form?
Presentation transcript:

Using xalan extensions to get the current date and time.

We use this area for alerts like server maintenance.

This is an example of an alert message. I want the alert message to no longer show after a given expiration date.

I want to compare the expiration date in to the current date. This is an example of the XML used for the alert message. defines whether or not to show the message (a manual on/off switch) is the date and time after which the message should no longer show.

Source: XSLT and XPATH Versions 2.0 With XSLT 2.0 and XPATH 2.0, this is how to get the current date and time. WebVoyage uses XSLT 1.0.

header.xsl 1.Define the java.util.GregorianCalendar namespace. 2.Import alert.xml and get the expiration date from. 3.Get the current date. 4.Compare the dates. 5.Display alert messages based on the result of the comparison. To get the current date and time, I used xalan extensions. Xalan extensions are installed on your WebVoyage server

header.xsl If $display is true and $isExpired is false, display the stylesheet for the alert. $display is based on the tag in the imported XML. $isExpired is true or false depending on whether the current date is greater than or less than the expiration date in the imported XML. A different stylesheet is used based on the id (headerRow or headerRowAlert)

header.xsl Again, if $display is true and $isExpired is false, display the alert.

header.xsl The part where the xalan extensions comes in is in the getCurrentDate template.

header.xsl We define the ‘cal’ namespace to be a xalan extension using the java.util.GregorianCalendar class from the Java API.

In the template, create a new cal object

java.util.GregorianCalendar[time= ,areFieldsSet=true,areAllFieldsSet=true,lenient=true, zone=sun.util.calendar.ZoneInfo[id="US/Central",offset= ,dstSavings= ,useDaylight=true, transitions=235,lastRule=java.util.SimpleTimeZone[id=US/Central,offset= ,dstSavings= , useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime= , startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime= ,endTimeMode=0]], firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=0,WEEK_OF_YEAR=5,WEEK_OF_MONTH=5, DAY_OF_MONTH=25,DAY_OF_YEAR=25,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=4,AM_PM=0,HOUR=11, HOUR_OF_DAY=11,MINUTE=27,SECOND=37,MILLISECOND=772,ZONE_OFFSET= ,DST_OFFSET=0] public static final int YEAR 1 public static final int MONTH 2 public static final int DAY_OF_MONTH 5 public static final int HOUR 11 public static final int MINUTE 12 public static final int SECOND 13 If we print the new object, we get a long string of information. We’re interested in the current year, month, day, hour, minute, second. But the constants didn’t work in XSLT. So I had to look up the constant values.

CONSTANT field values Defined in java.util.CALENDAR CONSTANT field values Defined in java.util.CALENDAR Using the constant values, I defined variables for the current year, month, day, hour, minute, and second.

The template returns date/time formatted as :27:37 With my variables, I created a string to represent the date. I formatted the string so the template could be re-used.

header.xsl 1.Get the current date using the xalan extension and getCurrentDate template. 2.Get the expiration date from the imported XML. 3.Remove punctuation from both variables with translate(). 4.Turn them into numbers with number(). 5.Compare the numbers ( > ). 6.The result of the comparison (true/false) is put in the $isExpired variable

The Apache Xalan Project Xalan Java Extensions Extensions Library Java 2 Platform API