1 / 33

XSLTC to the Rescue Brief Introduction to XSLTC and a uPortal Case Study

XSLTC to the Rescue Brief Introduction to XSLTC and a uPortal Case Study. Katya Sadovsky Administrative Computing Services UC Irvine. Agenda. Overview What is XSLTC XSLT/XSTLC performance comparison demo How it works XSLTC Transformer Attributes Compiling & Running Translets

arva
Download Presentation

XSLTC to the Rescue Brief Introduction to XSLTC and a uPortal Case Study

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XSLTC to the RescueBrief Introduction to XSLTC and a uPortal Case Study Katya Sadovsky Administrative Computing Services UC Irvine Presented at the JA-SIG conference, December 2003

  2. 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 Presented at the JA-SIG conference, December 2003

  3. 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. Presented at the JA-SIG conference, December 2003

  4. Performance Demo Presented at the JA-SIG conference, December 2003

  5. Overview: How it Works Presented at the JA-SIG conference, December 2003

  6. 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. Presented at the JA-SIG conference, December 2003

  7. XSLTC Transformer Attributes Presented at the JA-SIG conference, December 2003

  8. 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 Presented at the JA-SIG conference, December 2003

  9. 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 Presented at the JA-SIG conference, December 2003

  10. 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. Presented at the JA-SIG conference, December 2003

  11. 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 Presented at the JA-SIG conference, December 2003

  12. XSLTC Translets: Using Java APIs Presented at the JA-SIG conference, December 2003

  13. Configuring uPortal 2.1.3 with XSLTC Presented at the JA-SIG conference, December 2003

  14. Outline • Performance Improvement Stats • uPortal Code Modifications • Issues & Solutions • Pre-compiling Translets Presented at the JA-SIG conference, December 2003

  15. 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' Presented at the JA-SIG conference, December 2003

  16. 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. Presented at the JA-SIG conference, December 2003

  17. 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 Presented at the JA-SIG conference, December 2003

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

  19. 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 Presented at the JA-SIG conference, December 2003

  20. 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 Presented at the JA-SIG conference, December 2003

  21. 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. Presented at the JA-SIG conference, December 2003

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

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

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

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

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

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

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

  29. Pre-compiling Translets • We use an Ant target to compile translets: Presented at the JA-SIG conference, December 2003

  30. 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 Presented at the JA-SIG conference, December 2003

  31. 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. Presented at the JA-SIG conference, December 2003

  32. Links & References • Xalan XSLTC Home: 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/xsltc_webpack.html • This presentation is available at http://snap.uci.edu/PortalDocs/articles/XSLTC.ppt • Our uPortal-based site: http://snap.uci.edu Presented at the JA-SIG conference, December 2003

  33. Q & A Presented at the JA-SIG conference, December 2003

More Related