Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.caucho.xsl

The XSLT transformation package.

See:
Description

Class Summary
CacheableDocument | A document wrapper allowing caching of XSL-generated content.
FormatNumberFun | The format-number(...) function.
JavaScriptStylesheet | Implementation class for JavaScript stylesheets.
JavaStylesheet | Implementation class for JavaScript stylesheets.
KeyFun | The key(...) function.
Sort |
Stylesheet | A compiled XSL stylesheet.
Stylesheet.Depend |
StylesheetImpl | Implementation base class for stylesheets.
Template |
Xsl | Public facade for creating XSL stylesheets.
XslNumberFormat | Formatting for the xsl:number action.
XslWriter | Writer stream for generating stylesheet output.

Exception Summary
XslParseException |

## Package com.caucho.xsl Description

The XSLT transformation package. XSLT transforms XML trees to XML trees using Stylesheets. The steps for a typical transformation are:

1. Create the XSLT stylesheet.
2. Read the source document.
3. Transform the source document.
4. Print the result.

The Caucho XSL package supports two related stylesheet languages. XSLT (W3C July draft ) 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").openWrite();
    XmlPrinter.printXml(os, dst);
    os.close();

XSLT-lite stylesheets are parsed directly by Xsl, because they are not valid XML documents. In addition, they treat unknown elements as text. When printing, therefore, applications should not automatically convert '<' to '&lt;'. ``

    // parse the stylesheet using 'XSLT-lite'
    Stylesheet style = Xsl.parse(Pwd.lookup("test.xsl"), null);

    // Parse the source document as HTML, not expanding entities
    XmlParser parser = Html.createParser();
    parser.setEntitiesAsText(true);
    Document src = parser.parse(Pwd.lookup("test.html");

    // Transform the document
    Document dst = style.transform(src);

    // Prints the result as HTML, not encoding entities
    WriteStream os = Pwd.lookup("test.out").openWrite();
    XmlPrinter printer = new XmlPrinter(os);
    printer.setVerbatimText(true);
    printer.setHtml(true);
    printer.printNode(dst);
    os.close();

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES