Java Doc for XSLT.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » utils » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.utils 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jasig.portal.utils.XSLT

All known Subclasses:   org.jasig.portal.i18n.LocaleAwareXSLT,
XSLT
public class XSLT (Code)
This utility provides methods for transforming XML documents via XSLT. It takes advantage of Xalan's ability to pre-compile stylehseets into StylesheetRoot objects. The first time a transform is requested, a stylesheet is compiled and cached.

None of the method signatures in this class should contain classes specific to a particular XSLT engine, e.g. Xalan, or XML parser, e.g. Xerces.

The constructor for XSLT takes an instance of whatever class is requesting the transformation. XSLT uses this instance to locate resources relative to the classpath.

Typical usage:

 XSLT xslt = new XSLT(this);
 xslt.setXML("myXMLDoc.xml");
 xslt.setSSL("myChannel.ssl", "aTitle", runtimeData.getBrowserInfo());
 xslt.setTarget(out);
 xslt.setStylesheetParameter("param1Name", "param1Value");
 xslt.setStylesheetParameter("param2Name", "param2Value");
 xslt.transform();
 


author:
   Ken Weiner, kweiner@unicon.net
version:
   $Revision: 42266 $


Field Summary
protected  Objectcaller
    
protected  ResourceBundlel18n
    
final protected static  StringmediaProps
    
protected  HashMapstylesheetParams
    
final protected static  HashtablestylesheetRootCache
    
protected static  booleanstylesheetRootCacheEnabled
    
final protected static  HashtablestylesheetSetCache
    
protected static  booleanstylesheetSetCacheEnabled
    
protected  ResultxmlResult
    
protected  SourcexmlSource
    
protected  StringxslURI
    

Constructor Summary
public  XSLT(Object instance)
     Constructs an XSLT object.

Method Summary
protected static  voidaddLocalization(Document xsl, ResourceBundle localization)
    
protected static  Stringescape(String s)
    
public static  SAXTransformerFactorygetSAXTFactory()
    
public static  intgetStylesheetCacheSize()
     Get the number of stylesheets in the stylesheet root cache.
public static  StylesheetSetgetStylesheetSet(String stylesheetListURI)
     This method caches compiled stylesheet set objects, keyed by the stylesheet list's URI.
public static  StringgetStylesheetURI(String sslUri, BrowserInfo browserInfo)
     Returns a stylesheet URI exactly as it appears in a stylesheet list file.
public static  StringgetStylesheetURI(String sslUri, String title, BrowserInfo browserInfo)
     Returns a stylesheet URI exactly as it appears in a stylesheet list file.
public static  TemplatesgetTemplates(String stylesheetURI, ResourceBundle l18n)
     This method caches compiled stylesheet objects, keyed by the stylesheet's URI and locale.
public static  TemplatesgetTemplates(String stylesheetURI)
     This method caches compiled stylesheet objects, keyed by the stylesheet's URI.
public static  XSLTgetTransformer(Object instance)
     Factory method that produces an XSLT transformer utility.
public static  XSLTgetTransformer(Object instance, Locale[] locales)
     Factory method that produces an XSLT transformer utility with a capability of choosing a stylesheet depending on a list of locales.
public static  TransformergetTransformer(String stylesheetURI, ResourceBundle l18n)
     This method returns a localized Transformer for a given stylesheet.
public static  TransformergetTransformer(String stylesheetURI)
     This method returns a Transformer for a given stylesheet.
public static  TransformerHandlergetTransformerHandler(String stylesheetURI)
     This method returns a TransformerHandler for a given stylesheet.
public static  TransformerHandlergetTransformerHandler(String stylesheetURI, Locale[] locales, Object caller)
     This method returns a localized TransformerHandler for a given stylesheet.
public static  voidpurgeStylesheetCache()
     Purge the cache of stylesheet roots and stylesheet sets.
public  voidsetResourceBundle(ResourceBundle bundle)
    
public  voidsetStylesheetParameter(String name, String value)
     Sets all the stylesheet parameters at once.
public  voidsetStylesheetParameters(Hashtable stylesheetParameters)
     Sets all the stylesheet parameters at once.
public  voidsetStylesheetParameters(HashMap stylesheetParameters)
     Sets all the stylesheet parameters at once.
public  voidsetTarget(ContentHandler contentHandler)
     Configures the xslt target.
public  voidsetTarget(java.io.OutputStream os)
     Configures the xslt target.
public  voidsetTarget(org.w3c.dom.Node node)
     Configures the xslt target.
public  voidsetXML(String xml)
     Configures the xml source.
public  voidsetXML(Node xml)
     Configures the xml source.
public  voidsetXML(java.io.InputStream is)
     Configures the xml source.
public  voidsetXML(java.io.File file)
     Configures the xml source.
public  voidsetXSL(String xslUri)
     Configures the xsl source.
public  voidsetXSL(String sslUri, String stylesheetTitle, BrowserInfo browserInfo)
     Configures the xsl source by choosing the appropriate stylesheet from the provided stylesheet list file.
public  voidsetXSL(String sslUri, BrowserInfo browserInfo)
     Configures the xsl source by choosing the appropriate stylesheet from the provided stylesheet list file.
public  StringtoString()
    
public  voidtransform()
     Performs a transformation.
public static  voidtransform(Source xmlSource, Result xmlResult, Hashtable stylesheetParams, String xslURI)
     Performs an XSL transformation.

Field Detail
caller
protected Object caller(Code)



l18n
protected ResourceBundle l18n(Code)



mediaProps
final protected static String mediaProps(Code)



stylesheetParams
protected HashMap stylesheetParams(Code)



stylesheetRootCache
final protected static Hashtable stylesheetRootCache(Code)



stylesheetRootCacheEnabled
protected static boolean stylesheetRootCacheEnabled(Code)



stylesheetSetCache
final protected static Hashtable stylesheetSetCache(Code)



stylesheetSetCacheEnabled
protected static boolean stylesheetSetCacheEnabled(Code)



xmlResult
protected Result xmlResult(Code)



xmlSource
protected Source xmlSource(Code)



xslURI
protected String xslURI(Code)




Constructor Detail
XSLT
public XSLT(Object instance)(Code)
Constructs an XSLT object. This contructor should be declared protected, but it will remain public for a while until most client code is changed to use the getTransformer() methods. Please avoid using this constructor!
Parameters:
  instance - the client of this utility




Method Detail
addLocalization
protected static void addLocalization(Document xsl, ResourceBundle localization)(Code)
Writes a set of key/value pairs from a resourcebundle as global variables in an xsl stylesheet
Parameters:
  xsl - the xsl stylesheet as a DOM document
Parameters:
  localization - the resource bundle of key/value pairs to be written to xsl variables



escape
protected static String escape(String s)(Code)
Escape problem characters which will be inserted into XSL
Parameters:
  s - the string to escape



getSAXTFactory
public static SAXTransformerFactory getSAXTFactory()(Code)



getStylesheetCacheSize
public static int getStylesheetCacheSize()(Code)
Get the number of stylesheets in the stylesheet root cache. the number of stylesheets in the stylesheet root cache.



getStylesheetSet
public static StylesheetSet getStylesheetSet(String stylesheetListURI) throws PortalException(Code)
This method caches compiled stylesheet set objects, keyed by the stylesheet list's URI.
Parameters:
  stylesheetListURI - the URI of the XSLT stylesheet list file (.ssl) the StlyesheetSet object
throws:
  PortalException -



getStylesheetURI
public static String getStylesheetURI(String sslUri, BrowserInfo browserInfo) throws PortalException(Code)
Returns a stylesheet URI exactly as it appears in a stylesheet list file.
Parameters:
  sslUri - the stylesheet list file URI
Parameters:
  browserInfo - the browser information the stylesheet URI as a string
throws:
  org.jasig.portal.PortalException -



getStylesheetURI
public static String getStylesheetURI(String sslUri, String title, BrowserInfo browserInfo) throws PortalException(Code)
Returns a stylesheet URI exactly as it appears in a stylesheet list file.
Parameters:
  sslUri - the stylesheet list file URI
Parameters:
  title - the stylesheet title
Parameters:
  browserInfo - the browser information the stylesheet URI as a string
throws:
  org.jasig.portal.PortalException -



getTemplates
public static Templates getTemplates(String stylesheetURI, ResourceBundle l18n) throws SAXException, PortalException, TransformerConfigurationException(Code)
This method caches compiled stylesheet objects, keyed by the stylesheet's URI and locale.
Parameters:
  stylesheetURI - the URI of the XSLT stylesheet
Parameters:
  l18n - the localized strings to add to the xsl the StlyesheetRoot object
throws:
  SAXException -



getTemplates
public static Templates getTemplates(String stylesheetURI) throws SAXException, PortalException(Code)
This method caches compiled stylesheet objects, keyed by the stylesheet's URI.
Parameters:
  stylesheetURI - the URI of the XSLT stylesheet the StlyesheetRoot object
throws:
  SAXException -



getTransformer
public static XSLT getTransformer(Object instance)(Code)
Factory method that produces an XSLT transformer utility.
Parameters:
  instance - the client of this utility a transformer utility
since:
   uPortal 2.2



getTransformer
public static XSLT getTransformer(Object instance, Locale[] locales)(Code)
Factory method that produces an XSLT transformer utility with a capability of choosing a stylesheet depending on a list of locales.
Parameters:
  instance - the client of this utility a locale-aware transformer utility
since:
   uPortal 2.2



getTransformer
public static Transformer getTransformer(String stylesheetURI, ResourceBundle l18n) throws SAXException, PortalException(Code)
This method returns a localized Transformer for a given stylesheet.
Parameters:
  stylesheetURI - the URI of the XSLT stylesheet Transformer
throws:
  SAXException -



getTransformer
public static Transformer getTransformer(String stylesheetURI) throws SAXException, PortalException(Code)
This method returns a Transformer for a given stylesheet.
Parameters:
  stylesheetURI - the URI of the XSLT stylesheet Transformer
throws:
  SAXException -



getTransformerHandler
public static TransformerHandler getTransformerHandler(String stylesheetURI) throws SAXException, PortalException(Code)
This method returns a TransformerHandler for a given stylesheet.
Parameters:
  stylesheetURI - the URI of the XSLT stylesheet Transformer
throws:
  SAXException -



getTransformerHandler
public static TransformerHandler getTransformerHandler(String stylesheetURI, Locale[] locales, Object caller) throws SAXException, PortalException(Code)
This method returns a localized TransformerHandler for a given stylesheet.
Parameters:
  stylesheetURI - the URI of the XSLT stylesheet
Parameters:
  locales - the list of locales
Parameters:
  caller - the calling class Transformer
throws:
  SAXException -



purgeStylesheetCache
public static void purgeStylesheetCache()(Code)
Purge the cache of stylesheet roots and stylesheet sets.



setResourceBundle
public void setResourceBundle(ResourceBundle bundle)(Code)



setStylesheetParameter
public void setStylesheetParameter(String name, String value)(Code)
Sets all the stylesheet parameters at once.
Parameters:
  name - the name of the stylesheet parameter
Parameters:
  value - the value of the stylesheet parameter



setStylesheetParameters
public void setStylesheetParameters(Hashtable stylesheetParameters)(Code)
Sets all the stylesheet parameters at once.
Parameters:
  stylesheetParameters - a Hashtable of stylesheet parameters



setStylesheetParameters
public void setStylesheetParameters(HashMap stylesheetParameters)(Code)
Sets all the stylesheet parameters at once.
Parameters:
  stylesheetParameters - a HashMap of stylesheet parameters



setTarget
public void setTarget(ContentHandler contentHandler)(Code)
Configures the xslt target.
Parameters:
  contentHandler - the content handler



setTarget
public void setTarget(java.io.OutputStream os)(Code)
Configures the xslt target.
Parameters:
  os - output stream



setTarget
public void setTarget(org.w3c.dom.Node node)(Code)
Configures the xslt target.
Parameters:
  node - target node



setXML
public void setXML(String xml)(Code)
Configures the xml source.
Parameters:
  xml - a string representing the xml document



setXML
public void setXML(Node xml)(Code)
Configures the xml source.
Parameters:
  xml - a node representing the xml document



setXML
public void setXML(java.io.InputStream is)(Code)
Configures the xml source.
Parameters:
  is - an input stream to the serialized xml source



setXML
public void setXML(java.io.File file)(Code)
Configures the xml source.
Parameters:
  file - a File object representing the xml source



setXSL
public void setXSL(String xslUri) throws PortalException(Code)
Configures the xsl source.
Parameters:
  xslUri - the URL of an XSLT stylesheet



setXSL
public void setXSL(String sslUri, String stylesheetTitle, BrowserInfo browserInfo) throws PortalException(Code)
Configures the xsl source by choosing the appropriate stylesheet from the provided stylesheet list file.
Parameters:
  sslUri - the URL of the stylesheet list file
Parameters:
  stylesheetTitle - the title of a stylesheet within the stylesheet list file
Parameters:
  browserInfo - the browser info object
throws:
  org.jasig.portal.PortalException -



setXSL
public void setXSL(String sslUri, BrowserInfo browserInfo) throws PortalException(Code)
Configures the xsl source by choosing the appropriate stylesheet from the provided stylesheet list file.
Parameters:
  sslUri - the URL of the stylesheet list file
Parameters:
  browserInfo - the browser info object
throws:
  org.jasig.portal.PortalException -



toString
public String toString()(Code)



transform
public void transform() throws PortalException(Code)
Performs a transformation. Assumes that the XML, XSL, and result targets have already been set.
throws:
  org.jasig.portal.PortalException -



transform
public static void transform(Source xmlSource, Result xmlResult, Hashtable stylesheetParams, String xslURI) throws PortalException(Code)
Performs an XSL transformation. Accepts stylesheet parameters (key, value pairs) stored in a Hashtable.
Parameters:
  xmlSource - the source to be transformedn
Parameters:
  xmlResult - the result to be populated
Parameters:
  stylesheetParams - a Hashtable of key/value pairs or null if no parameters
Parameters:
  xslURI - the uri of the stylesheet to be used
throws:
  org.jasig.portal.PortalException - if something goes wrong



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.