xslt PreviousNext

Description

Invoke XSLT Processor.

Parameters

processor
Description: Name of XSLT processor

Domain: xalan_cpp|xalan_java|xsltproc|gexslt

Default: xalan_cpp

JDK 1.4 notes: Since with JDK 1.4 Xalan is included you do not have to make any additional configuration like putting Xalan, Xerces into the classpath. On how to use newer versions of Xalan than the one coming with the JDK 1.4 refer to the Xalan homepage on http://xml.apache.org/xalan-j. In JDK 1.5 it changed again and by default there is no possibility anymore to invoke xalan from the commandline (see http://www.biglist.com/lists/xsl-list/archives/200503/msg01112.html for more information) and in addition the packagenames in the JDK changed (from org.apache.xalan.xslt.Process to com.sun.org.apache.xalan.internal.xslt.Process). Probably the easies way with JDK 1.5 is to put Xalan again in the classpath as it was done with JDK1.3 but I did not spend very much time yet to investigate further.

Java 5 notes: In Java 5 it changed again and by default there is no possibility anymore to invoke xalan from the commandline (see http://www.biglist.com/lists/xsl-list/archives/200503/msg01112.html for more information) and in addition the packagenames in the JDK changed (from org.apache.xalan.xslt.Process to com.sun.org.apache.xalan.internal.xslt.Process). Probably the easies way with Java 5 is to put Xalan again in the classpath as it was done with JDK 1.3 but I did not spend a lot of time to investigate further.

input
Description: Name of XML input file

Domain: Valid filename pointing to existing file

Default: -

xsl
Description: Name of stylesheet (XSL) file

Domain: Valid filename pointing to existing file

Default: -

output
Description: Name of output file

Domain: Valid filename

Default: -

force
Description: Execute even if it would not be necessary since the outputfile is newer than both the input and the xsl file

Domain: Boolean (true|false)

Default: false

indent
Description: Number of spaces for indentation of child elements

Domain: Integer

Default: 4

RNG Specification

  <define name="xslt">
    <element name="xslt">
      <ref name="dir_if_unless"/>
      <attribute name="input"/>
      <attribute name="output"/>
      <attribute name="stylesheet"/>
      <optional>
        <attribute name="processor">
          <!-- runtime evaluation
          <choice>
            <value>xalan_cpp</value>
            <value>xalan_java</value>
            <value>xsltproc</value>
          </choice>
          -->
        </attribute>
      </optional>
      <optional>
        <attribute name="force">
          <!-- runtime evaluation
          <choice>
            <value>true</value>
            <value>false</value>
          </choice>
          -->
        </attribute>
      </optional>
      <optional>
        <attribute name="indent"/> <!-- if attribute 'processor' equals 'xalan_java' or 'xalan_cpp'--><-- TODO - implement for gexslt -->
      </optional>
      <optional>
        <attribute name="format"/> <!-- if attribute 'processor' equals 'xalan_java' -->
      </optional>
      <zeroOrMore>
        <element name="parameter">
          <attribute name="name"/>
          <attribute name="value"/>
        </element>
      </zeroOrMore>
      <optional>
        <attribute name="extdirs"/> <!-- if attribute 'processor' equals 'xalan_java' -->
      </optional>
      <optional>
        <attribute name="classpath"/> <!-- if attribute 'processor' equals 'xalan_java' -->
      </optional>
    </element>
  </define>

  

Examples

Note that string parameters must be surrounded by a single quote ('), else they will be interpreted as a number.

For gexslt, all parameters are string values, so the single quotes are not needed, unless they contain embedded blanks, which might confuse the shell.

Gexslt can also take any XPath expression as a parameter value, but this is not possible via geant.

  <xslt
    input="${GOBO}/doc/structure/index.xml"
    stylesheet="${GOBO}/doc/misc/gobo2db.xsl"
    output="${GOBO}/doc/structure/index2.xml"
  >

  <xslt
    input="${GOBO}/doc/structure/index.xml"
    stylesheet="${GOBO}/doc/misc/gobo2html.xsl"
    output="${GOBO}/doc/structure/index2.html"
  >
    <parameter name="previous" value="&quot;'../license.html'&quot;"/>
    <parameter name="next" value="&quot;'../time/index.html'&quot;"/>
    <parameter name="toc" value="&quot;'../index.html'&quot;"/>
  </xslt>

  

Copyright © 2002-2005, Sven Ehrke
mailto:ericb@gobosoft.com
http://www.gobosoft.com
Last Updated: 7 July 2005
HomeTocPreviousNext