Processes a set of XML documents via XSLT. This is
useful for building views of XML based documentation.
This task for running Saxon transformations within Ant is modelled on the
standard Ant xslt task (org.apache.tools.ant.taskdefs.XSLTProcess), and makes heavy reuse of its code.
See Apache notice above.
add
public void add(FileNameMapper fileNameMapper)
throws BuildException
Adds a nested filenamemapper.
fileNameMapper
- the mapper to add
add
public void add(ResourceCollection rc)
Adds a collection of resources to style in addition to the
given file or the implicit fileset.
rc
- the collection of resources to style
addConfiguredStyle
public void addConfiguredStyle(Resources rc)
Add a nested <style> element.
rc
- the configured Resources object represented as <style>.
addConfiguredXMLCatalog
public void addConfiguredXMLCatalog(XMLCatalog xmlCatalog)
Add the catalog to our internal catalog
xmlCatalog
- the XMLCatalog instance to use to look up DTDs
addMapper
public void addMapper(Mapper mapper)
Defines the mapper to map source to destination files.
mapper
- the mapper to use
configureLiaison
protected void configureLiaison(File stylesheet)
throws BuildException
since Ant 1.7
Loads the stylesheet and set xsl:param parameters.
stylesheet
- the file from which to load the stylesheet.
configureLiaison
protected void configureLiaison(Resource stylesheet)
throws BuildException
Loads the stylesheet and set xsl:param parameters.
stylesheet
- the resource from which to load the stylesheet.
createClasspath
public Path createClasspath()
Set the optional classpath to the XSL processor
- a path instance to be configured by the Ant core.
createOutputProperty
public AntTransform.OutputProperty createOutputProperty()
Create an instance of an output property to be configured.
- the newly created output property.
createParam
public AntTransform.Param createParam()
Create an instance of an XSL parameter for configuration by Ant.
- an instance of the Param class to be configured.
execute
public void execute()
throws BuildException
Executes the task.
getOutputProperties
public Enumeration getOutputProperties()
Get an enumeration on the outputproperties.
getXMLCatalog
public XMLCatalog getXMLCatalog()
Get the XML catalog containing entity definitions
- the XML catalog for the task.
init
public void init()
throws BuildException
Initialize internal instance of XMLCatalog
setBasedir
public void setBasedir(File dir)
Set the base directory;
optional, default is the project's basedir.
setClasspath
public void setClasspath(Path classpath)
Set the optional classpath to the XSL processor
classpath
- the classpath to use when loading the XSL processor
setClasspathRef
public void setClasspathRef(Reference r)
Set the reference to an optional classpath to the XSL processor
r
- the id of the Ant path instance to act as the classpath
for loading the XSL processor
setDTDValidation
public void setDTDValidation(boolean validation)
Indicate whether DTD validation is on or off
validation
- set to true to request DTD validation of all input files to the transformation
setDestdir
public void setDestdir(File dir)
Set the destination directory into which the XSL result
files should be copied to;
required, unless in and out are
specified.
dir
- the name of the destination directory
setExpandDefaults
public void setExpandDefaults(boolean expand)
Set whether DTD or schema-defined element and attribute default values should be expanded
Default is true
expand
- true to expand default values, false if they are to be suppressed
setExtension
public void setExtension(String name)
Set the desired file extension to be used for the target;
optional, default is html.
name
- the extension to use
setFileDirParameter
public void setFileDirParameter(String fileDirParameter)
Pass the directory name of the current processed file as a xsl parameter
to the transformation. This value sets the name of that xsl parameter.
fileDirParameter
- name of the xsl parameter retrieving the
current file directory
setFileNameParameter
public void setFileNameParameter(String fileNameParameter)
Pass the filename of the current processed file as a xsl parameter
to the transformation. This value sets the name of that xsl parameter.
fileNameParameter
- name of the xsl parameter retrieving the
current file name
setForce
public void setForce(boolean force)
Set whether to check dependencies, or always generate;
optional, default is false.
force
- true if always generate.
setIn
public void setIn(File inFile)
specifies a single XML document to be styled. Should be used
with the out attribute; ; required if out is set
setInitialMode
public void setInitialMode(String mode)
Set the initial mode
mode
- the initial mode for the transformation, in Clark notation
setInitialTemplate
public void setInitialTemplate(String name)
Set the initial template
name
- the name of the initial template for the transformation, in Clark notation
setLineNumbering
public void setLineNumbering(boolean numbering)
Set whether to maintain line numbers for input documents
numbering
- true to maintain line numbers. Default is false
setOut
public void setOut(File outFile)
Specifies the output name for the styled result from the
in attribute; required if in is set
outFile
- the output File instance.
setRecoveryPolicy
public void setRecoveryPolicy(String policy)
Set the policy for handling recoverable errors
policy
- one of "silent", "recover", or "fatal". Default is "recover".
setReloadStylesheet
public void setReloadStylesheet(boolean b)
Controls whether the stylesheet is reloaded for every transform.
Setting this to true may get around a bug in certain
Xalan-J versions, default is false.
setScanIncludedDirectories
public void setScanIncludedDirectories(boolean b)
Set whether to style all files in the included directories as well;
optional, default is true.
b
- true if files in included directories are processed.
setSchemaAware
public void setSchemaAware(boolean schemaAware)
Indicate whether schema-aware processing is required
schemaAware
- true if schema-aware processing is required
setSchemaValidation
public void setSchemaValidation(String validation)
Indicate whether schema validation for all input files to the transformation is strict, lax, or skip
validation
- "strict", "lax" or "skip"
setStyle
public void setStyle(String xslFile)
Name of the stylesheet to use - given either relative
to the project's basedir or as an absolute path; required.
xslFile
- the stylesheet to use
setTracing
public void setTracing(boolean tracing)
Set whether to trace stylesheet execution
tracing
- true to trace execution. Default is false
setUseImplicitFileset
public void setUseImplicitFileset(boolean useimplicitfileset)
Set whether to use the implicit fileset.
Set this to false if you want explicit control with nested
resource collections.
useimplicitfileset
- set to true if you want to use implicit fileset
setXmlVersion
public void setXmlVersion(String version)
Set the XML version to be used for validating names
version
- One of "1.0" or "1.1". Default is "1.0".
setXslResource
public void setXslResource(Resource xslResource)
API method to set the XSL Resource.
xslResource
- Resource to set as the stylesheet.