Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.caucho.xsl
Class Xsl

    java.lang.Object
      |
      +--com.caucho.xsl.Xsl

public class Xsl
extends java.lang.Object

Public facade for creating XSL stylesheets.

Xsl supports two related stylesheet languages. XSLT and 'XSLT-lite'. Strict XSLT stylesheets are created by parsing the XML externally, then generating the stylesheet: ``

     Document xsl = Xml.parse(Pwd.lookup("test.xsl"));
     Stylesheet style = Xsl.parse(xsl, null);

     Document src = Xml.parse(Pwd.lookup("test.xml");
     Document dst = style.transform(src);

     WriteStream os = Pwd.lookup("test.out").openRead();
     XmlPrinter.printXml(os, dst);
     os.close();

XSLT-lite stylesheets are parsed directly by Xsl, because they are not valid XML documents. ``

     ReadStream is = Pwd.lookup("test.xsl").openRead();
     Stylesheet style = Xsl.parse(is, null);
     is.close();

     Document src = Xml.parse(Pwd.lookup("test.xml");
     Document dst = style.transform(src);

     ReadStream os = Pwd.lookup("test.out").openRead();
     XmlPrinter.printXml(os, dst);
     os.close();

Method Summary
`static Path` | `findXslPath(java.lang.String xsl, Path[] stylePath, java.lang.ClassLoader loader)`
`static Stylesheet` | `getLooseStylesheet(java.lang.String xsl, Path[] stylePath, java.lang.ClassLoader loader, Path[] scriptPath)`
`static Stylesheet` | `getStylesheet(java.lang.String xsl, Path[] stylePath, java.lang.ClassLoader loader, Path[] scriptPath)`
`static void` | `main(java.lang.String[] args)`
`static Stylesheet` | `parse(Document xsl, Path path, Path[] stylePath, Path[] scriptPath, java.lang.ClassLoader loader, java.lang.String className)` Creates a strict XSLT stylesheet based on the XML document.
`static Stylesheet` | `parse(Path path, Path[] stylePath, Path[] scriptPath)` Convenience class for the XSLT-lite parser.
`static Stylesheet` | `parse(ReadStream is, Path[] stylePath, Path[] scriptPath, java.lang.ClassLoader loader, java.lang.String className)` Creates an 'XSLT-lite' stylesheet from a stream.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### parse

    public static Stylesheet parse(ReadStream is,
                                   Path[] stylePath,
                                   Path[] scriptPath,
                                   java.lang.ClassLoader loader,
                                   java.lang.String className)
                            throws java.lang.Exception

  Creates an 'XSLT-lite' stylesheet from a stream. The syntax for XSLT-lite allows some extensions like <{@foo}> for xsl:value-of and <#= ... #> for xsl:expression.

  More importantly, tags outside the xsl: namespace are treated as raw text and entities are not expanded.

  The parser will load precompiled stylesheets if you specify the className. Obviously, className must be unique for different stylesheets.

  Parameters:
    `is` - stream containing the stylesheet
    `stylePath` - path to lookup imported stylesheets.
    `scriptPath` - path for the scripting language imports
    `loader` - the class loader for loading the new stylesheet
    `className` - the class name of the generated stylesheet. This must be specified for precompiled servlets.
  Returns:
    the generated stylesheet.

### parse

    public static Stylesheet parse(Path path,
                                   Path[] stylePath,
                                   Path[] scriptPath)
                            throws java.lang.Exception

  Convenience class for the XSLT-lite parser.

### parse

    public static Stylesheet parse(Document xsl,
                                   Path path,
                                   Path[] stylePath,
                                   Path[] scriptPath,
                                   java.lang.ClassLoader loader,
                                   java.lang.String className)
                            throws java.lang.Exception

  Creates a strict XSLT stylesheet based on the XML document.

  The parser will load precompiled stylesheets if you specify the className. Obviously, className must be unique for different stylesheets.

  Parameters:
    `xsl` - The XML parsed document for the stylesheet
    `path` - The pwd of the parsed document
    `stylePath` - search path for imported stylesheets
    `scriptPath` - search path for imported scripts
    `loader` - the class loader for loading the new stylesheet
    `className` - the class name of the generated stylesheet. This must be specified for precompiled servlets.

### getStylesheet

    public static Stylesheet getStylesheet(java.lang.String xsl,
                                           Path[] stylePath,
                                           java.lang.ClassLoader loader,
                                           Path[] scriptPath)
                                    throws java.io.IOException

### getLooseStylesheet

    public static Stylesheet getLooseStylesheet(java.lang.String xsl,
                                                Path[] stylePath,
                                                java.lang.ClassLoader loader,
                                                Path[] scriptPath)
                                         throws java.io.IOException

### findXslPath

    public static Path findXslPath(java.lang.String xsl,
                                   Path[] stylePath,
                                   java.lang.ClassLoader loader)

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD