Presentation is loading. Please wait.

Presentation is loading. Please wait.

University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLTC to the Rescue Brief Introduction to XSLTC and a uPortal Case Study.

Similar presentations


Presentation on theme: "University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLTC to the Rescue Brief Introduction to XSLTC and a uPortal Case Study."— Presentation transcript:

1 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLTC to the Rescue Brief Introduction to XSLTC and a uPortal Case Study Katya Sadovsky Administrative Computing Services UC Irvine

2 University of California, Irvine Presented at the JA-SIG conference, December 2003 Agenda  Overview  What is XSLTC  XSLT/XSTLC performance comparison demo  How it works  XSLTC Transformer Attributes  Compiling & Running Translets  Case study: using XSLTC with uPortal  Setting up uPortal with XSLTC  Required Code Modifications  Q&A

3 University of California, Irvine Presented at the JA-SIG conference, December 2003 Overview: What is XSLTC  Java-based XSLTC was originally developed by Sun Microsystems XML Technology Center.  It has since been donated to Apache’s Xalan-J2 project (This presentation will cover the Apache Xalan 2.5.1 XSLTC tool).  As opposed to using interpreted XSL transformations, XSLTC allows users to pre-compile style-sheets into reusable byte code.  XSTLC yields significant performance improvement for server-side processing.

4 University of California, Irvine Presented at the JA-SIG conference, December 2003 Performance Demo

5 University of California, Irvine Presented at the JA-SIG conference, December 2003 Overview: How it Works

6 University of California, Irvine Presented at the JA-SIG conference, December 2003 Overview: How it Works  XSL style-sheet instructions are compiled into Java byte code: translet classes.  Translets typically have a very small memory footprint.  Once translets are compiled, they can be used for transformations.  You may save translet class files on disk and re- use them at a later time.

7 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLTC Transformer Attributes

8 University of California, Irvine Presented at the JA-SIG conference, December 2003 Compiling Translets  There are several ways to compile translets:  pre-compile translets into class files using a command-line utility  compile translets on the fly while running a transformation with command-line utility  Compile translets on the fly while running transformations using Java APIs

9 University of California, Irvine Presented at the JA-SIG conference, December 2003 Running Translets  There are also two ways to run transformations:  Using command-line utilities:  XSLTC-specific transformation processor class  Regular Xalan transformation processor class with a few extra options  Using Java APIs

10 University of California, Irvine Presented at the JA-SIG conference, December 2003 Compiling Translets: Command Line Utility  Xalan-J XSLTC library comes with a command line utility to pre-compile style-sheets:  Executing java -classpath xalan.jar:xercesImpl.jar:xml-apis.jar org.apache.xalan.xsltc.cmdline.Compile xhtml.xsl will create xhtml.class under the current working directory.  Executing java -classpath xalan.jar:xercesImpl.jar:xml-apis.jar org.apache.xalan.xsltc.cmdline.Compile –p edu.uci.translets xhtml.xsl will create edu/uci/translets/xhtml.class under the current working directory.

11 University of California, Irvine Presented at the JA-SIG conference, December 2003 Running Translets: Command Line Utility  To run a transformation with a pre-compiled translet execute java -classpath xalan.jar:xercesImpl.jar:xml- apis.jar org.apache.xalan.xsltc.cmdline.Transform sample.xhtml org.jasig.portal.channels.webproxy.translet.xhtml  You may also use the regular Xalan command line utility to run XSLTC transformations and generate translets: java -classpath xalan.jar:xercesImpl.jar:xml-apis.jar org.apache.xalan.xslt.Process -XSLTC -IN sample.xhtml -XSL xhtml.xsl -XO –XP org.jasig.portal.channels.webproxy.translet

12 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLTC Translets: Using Java APIs

13 University of California, Irvine Presented at the JA-SIG conference, December 2003 Configuring uPortal 2.1.3 with XSLTC

14 University of California, Irvine Presented at the JA-SIG conference, December 2003 Outline  Performance Improvement Stats  uPortal Code Modifications  Issues & Solutions  Pre-compiling Translets

15 University of California, Irvine Presented at the JA-SIG conference, December 2003 Performance Improvement Stats  The following are results of running XSLT and XSLTC based transformations on uPortal’s CGenericXSLT channel with style-sheet caching set to 'on'

16 University of California, Irvine Presented at the JA-SIG conference, December 2003 Issues & Solutions  Issue  XSLTC functionality is still limited, so not all the style-sheets will work with it  Solution  Apply XSLTC selectively : only use it if a pre-compiled translet exists. Use XSLT in all other cases.

17 University of California, Irvine Presented at the JA-SIG conference, December 2003 Issues & Solutions, cont’d  Issue  XSLTC bug: NullPointerException in org.apache.xalan.xsltc.trax.DOM2SAX (line 350):  Solution  Fixed the bug:  Recompiled the code and rebuilt xalan.jar

18 University of California, Irvine Presented at the JA-SIG conference, December 2003 Issues & Solutions, cont’d  Issue  When the destination-directory attribute is not set, the transformer factory will look for the translet in /.  Solution  Keep this in mind when pre-compiling the style-sheets: set the destination-directory to.

19 University of California, Irvine Presented at the JA-SIG conference, December 2003 uPortal Code Modifications  Our uPortal implementation uses a combination of XSLT and XSLTC based transformations.  The following uPortal files had to be modified to enable XSLTC processing:  properties/portal.properties  source/org/jasig/portal/utils/XSLT.java

20 University of California, Irvine Presented at the JA-SIG conference, December 2003 Code Modifications: portal.properties  We wanted to have the ability to turn off all XSLTC based transformations in uPortal. Hence, we added the following property to portal.properties file: org.jasig.portal.utils.XSLT.useXSLTC=true

21 University of California, Irvine Presented at the JA-SIG conference, December 2003 Code Modifications: XSLT.java  Since we use a combination of XSLT and XSLTC based transformations, we needed to operate with two different transformer factories. The following methods were changed:  getSAXTFactory()  getTemplates()  getTransformerHandler()  The following slides contain a simplified view of our implementation.

22 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLT.java: Global Class Changes

23 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLT.java: original getSAXTFactory method

24 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLT.java: modified getSAXTFactory method

25 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLT.java: original getTemplates method

26 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLT.java: modified getTemplates method

27 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLT.java: original getTrasformerHandler method

28 University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLT.java: modified getTrasformerHandler method

29 University of California, Irvine Presented at the JA-SIG conference, December 2003 Pre-compiling Translets  We use an Ant target to compile translets:

30 University of California, Irvine Presented at the JA-SIG conference, December 2003 Pre-compiling Translets  uPortal style-sheets we pre-compile:  org/jasig/portal/layout/tab-column/nested-tables/*.xsl  org/jasig/portal/layout/tab-column/*.xsl  org/jasig/portal/channels/permissionsmanager/*.xsl  org/jasig/portal/channels/webproxy/*.xsl  org/jasig/portal/channels/CHeader/*.xsl  org/jasig/portal/channels/Clogin/*.xsl  org/jasig/portal/channels/Capplet/*.xsl  org/jasig/portal/channels/CSelectSystemProfile/*.xsl  org/jasig/portal/channels/CGenericXSLT/*.xsl  org/jasig/portal/channels/CGenericXSLT/footer/*.xsl  org/jasig/portal/channels/CGenericXSLT/RSS/*.xsl  org/jasig/portal/channels/CError/*.xsl  org/jasig/portal/channels/CUserPreferences/*.xsl  org/jasig/portal/channels/CUserPreferences/tab-column  org/jasig/portal/channels/CInlineFrame/*.xsl  org/jasig/portal/channels/CImage/*.xsl  org/jasig/portal/channels/bookmarks/*.xsl

31 University of California, Irvine Presented at the JA-SIG conference, December 2003 Conclusions  XSLTC technology is still relatively new. However,  In most situations it may significantly improve transformation performance,especially for large input documents.  Performance improvements also allow for better scalability.  uPortal software can be XSLTC-enabled with minimal code modifications.

32 University of California, Irvine Presented at the JA-SIG conference, December 2003 Links & References  Xalan XSLTC Home: http://xml.apache.org/xalan-j/xsltc_usage.html http://xml.apache.org/xalan-j/xsltc_usage.html  XSLTC and the Java Web Services Developer Pack (Sun): http://wwws.sun.com/software/xml/developers/xsltc/x sltc_webpack.html http://wwws.sun.com/software/xml/developers/xsltc/x sltc_webpack.html  This presentation is available at http://snap.uci.edu/PortalDocs/articles/XSLTC.ppt http://snap.uci.edu/PortalDocs/articles/XSLTC.ppt  Our uPortal-based site: http://snap.uci.edu http://snap.uci.edu

33 University of California, Irvine Presented at the JA-SIG conference, December 2003 Q & A


Download ppt "University of California, Irvine Presented at the JA-SIG conference, December 2003 XSLTC to the Rescue Brief Introduction to XSLTC and a uPortal Case Study."

Similar presentations


Ads by Google