caucho
 Command Line


To transform documents with XSL on the command line use the com.caucho.xsl.Xsl class.

The CLASSPATH needs to include the following jar files:

  • lib/dom.jar
  • lib/resin-xml.jar
  • lib/resin-xsl.jar

The following trivial example just replaces the tag <hello/> with Hello, World.

hello.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="hello">
  <html>
  <body>
  <xsl:text>Hello, World</xsl:text>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>
hello.xml
<hello/>

By default, the command-line XSL prints to standard out. So a command-line invocation with CLASSPATH already configured might look like:

unix> java com.caucho.xsl.Xsl -xsl hello.xsl hello.xml
<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 4.0 Frameset//EN"
                  "http://www.w3c.org/TR/REC-html40/frameset.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>Hello, World</body>
</html>

command-line options
-xsl stylesheetSelect a stylesheet
-o pathSets the result file or directory to path
-stylescriptUses the StyleScript syntax instead of strict XSL
-conf resin.confSelect a different resin.conf
-suffix htmlSets the replacement suffix to html


Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.