public class XSLTProcess extends MatchingTask implements XSLTLogger
Type | Property and Description |
---|---|
XSLTProcess.OutputProperty |
createOutput
Create an instance of an output property to be configured.
|
Modifier and Type | Class and Description |
---|---|
static class |
XSLTProcess.Factory
The factory element to configure a transformer factory
|
static class |
XSLTProcess.OutputProperty
Specify how the result tree should be output as specified
in the
specification.
|
static class |
XSLTProcess.Param
The Param inner class used to store XSL parameters
|
static class |
XSLTProcess.ParamType
Enum for types of the parameter expression.
|
class |
XSLTProcess.TraceConfiguration
Configuration for Xalan2 traces.
|
Modifier and Type | Field and Description |
---|---|
static String |
PROCESSOR_TRAX
The default processor is trax
|
fileset
Constructor and Description |
---|
XSLTProcess()
Creates a new XSLTProcess Task.
|
Modifier and Type | Method and Description |
---|---|
void |
add(FileNameMapper fileNameMapper)
Adds a nested filenamemapper.
|
void |
add(ResourceCollection rc)
Adds a collection of resources to style in addition to the
given file or the implicit fileset.
|
void |
addConfiguredStyle(Resources rc)
Add a nested <style> element.
|
void |
addConfiguredXMLCatalog(XMLCatalog xmlCatalog)
Add the catalog to our internal catalog
|
void |
addMapper(Mapper mapper)
Defines the mapper to map source to destination files.
|
void |
addSysproperty(Environment.Variable sysp)
A system property to set during transformation.
|
void |
addSyspropertyset(PropertySet sysp)
A set of system properties to set during transformation.
|
protected void |
configureLiaison(Resource stylesheet)
Loads the stylesheet and set xsl:param parameters.
|
Path |
createClasspath()
Set the optional classpath to the XSL processor
|
XSLTProcess.Factory |
createFactory()
Create the factory element to configure a trax liaison.
|
XSLTProcess.OutputProperty |
createOutputProperty()
Create an instance of an output property to be configured.
|
XSLTProcess.Param |
createParam()
Create an instance of an XSL parameter for configuration by Ant.
|
XSLTProcess.TraceConfiguration |
createTrace()
Enables Xalan2 traces and uses the given configuration.
|
void |
execute()
Executes the task.
|
XSLTProcess.Factory |
getFactory()
Get the factory instance configured for this processor
|
protected XSLTLiaison |
getLiaison()
Get the Liaison implementation to use in processing.
|
Enumeration |
getOutputProperties()
Get an enumeration on the outputproperties.
|
boolean |
getSuppressWarnings()
Whether to suppress warning messages of the processor.
|
XSLTProcess.TraceConfiguration |
getTraceConfiguration()
Configuration for Xalan2 traces.
|
XMLCatalog |
getXMLCatalog()
Get the XML catalog containing entity definitions
|
protected void |
handleError(String msg)
Throws an exception with the given message if failOnError is
true, otherwise logs the message using the WARN level.
|
protected void |
handleError(Throwable ex)
Throws an exception with the given nested exception if
failOnError is true, otherwise logs the message using the WARN
level.
|
protected void |
handleTransformationError(Exception ex)
Throws an exception with the given nested exception if
failOnError and failOnTransformationError are true, otherwise
logs the message using the WARN level.
|
void |
init()
Initialize internal instance of XMLCatalog.
|
void |
setBasedir(File dir)
Set the base directory;
optional, default is the project's basedir.
|
void |
setClasspath(Path classpath)
Set the optional classpath to the XSL processor
|
void |
setClasspathRef(Reference r)
Set the reference to an optional classpath to the XSL processor
|
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.
|
void |
setExtension(String name)
Set the desired file extension to be used for the target;
optional, default is html.
|
void |
setFailOnError(boolean b)
Whether any errors should make the build fail.
|
void |
setFailOnNoResources(boolean b)
Whether the build should fail if the nested resource collection is empty.
|
void |
setFailOnTransformationError(boolean b)
Whether transformation errors should make the build fail.
|
void |
setFileDirParameter(String fileDirParameter)
Pass the directory name of the current processed file as a xsl parameter
to the transformation.
|
void |
setFileNameParameter(String fileNameParameter)
Pass the filename of the current processed file as a xsl parameter
to the transformation.
|
void |
setForce(boolean force)
Set whether to check dependencies, or always generate;
optional, default is false.
|
void |
setIn(File inFile)
specifies a single XML document to be styled.
|
void |
setOut(File outFile)
Specifies the output name for the styled result from the
in attribute; required if in is set
|
void |
setProcessor(String processor)
Set the name of the XSL processor to use; optional, default trax.
|
void |
setReloadStylesheet(boolean b)
Controls whether the stylesheet is reloaded for every transform.
|
void |
setScanIncludedDirectories(boolean b)
Whether to style all files in the included directories as well;
optional, default is true.
|
void |
setStyle(String xslFile)
Name of the stylesheet to use - given either relative
to the project's basedir or as an absolute path; required.
|
void |
setSuppressWarnings(boolean b)
Whether to suppress warning messages of the processor.
|
void |
setUseImplicitFileset(boolean useimplicitfileset)
Whether to use the implicit fileset.
|
void |
setXslResource(Resource xslResource)
API method to set the XSL Resource.
|
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
log
public XSLTProcess.OutputProperty createOutputProperty
public static final String PROCESSOR_TRAX
public void add(FileNameMapper fileNameMapper) throws BuildException
fileNameMapper
- the mapper to addBuildException
- if more than one mapper is definedpublic void add(ResourceCollection rc)
rc
- the collection of resources to stylepublic void addConfiguredStyle(Resources rc)
rc
- the configured Resources object represented as <style>.public void addConfiguredXMLCatalog(XMLCatalog xmlCatalog)
xmlCatalog
- the XMLCatalog instance to use to look up DTDspublic void addMapper(Mapper mapper)
mapper
- the mapper to useBuildException
- if more than one mapper is definedpublic void addSysproperty(Environment.Variable sysp)
public void addSyspropertyset(PropertySet sysp)
protected void configureLiaison(Resource stylesheet) throws BuildException
stylesheet
- the resource from which to load the stylesheet.BuildException
- if the stylesheet cannot be loaded.public Path createClasspath()
public XSLTProcess.Factory createFactory() throws BuildException
BuildException
- if the element is created more than one time.public XSLTProcess.OutputProperty createOutputProperty()
public XSLTProcess.Param createParam()
public XSLTProcess.TraceConfiguration createTrace()
Note that this element doesn't have any effect with a processor other than trax or if the Transformer is not Xalan2's transformer implementation.
public void execute() throws BuildException
execute
in class Task
BuildException
- if there is an execution problem.public XSLTProcess.Factory getFactory()
protected XSLTLiaison getLiaison()
public Enumeration getOutputProperties()
public boolean getSuppressWarnings()
public XSLTProcess.TraceConfiguration getTraceConfiguration()
public XMLCatalog getXMLCatalog()
protected void handleError(String msg)
protected void handleError(Throwable ex)
protected void handleTransformationError(Exception ex)
public void init() throws BuildException
init
in class Task
BuildException
- on errorpublic void setBasedir(File dir)
dir
- the base directorypublic void setClasspath(Path classpath)
classpath
- the classpath to use when loading the XSL processorpublic void setClasspathRef(Reference r)
r
- the id of the Ant path instance to act as the classpath
for loading the XSL processorpublic void setDestdir(File dir)
dir
- the name of the destination directorypublic void setExtension(String name)
name
- the extension to usepublic void setFailOnError(boolean b)
public void setFailOnNoResources(boolean b)
public void setFailOnTransformationError(boolean b)
public void setFileDirParameter(String fileDirParameter)
fileDirParameter
- name of the xsl parameter retrieving the
current file directorypublic void setFileNameParameter(String fileNameParameter)
fileNameParameter
- name of the xsl parameter retrieving the
current file namepublic void setForce(boolean force)
force
- true if always generate.public void setIn(File inFile)
inFile
- the input filepublic void setOut(File outFile)
outFile
- the output File instance.public void setProcessor(String processor)
processor
- the name of the XSL processorpublic void setReloadStylesheet(boolean b)
Setting this to true may get around a bug in certain Xalan-J versions, default is false.
b
- a boolean
valuepublic void setScanIncludedDirectories(boolean b)
b
- true if files in included directories are processed.public void setStyle(String xslFile)
xslFile
- the stylesheet to usepublic void setSuppressWarnings(boolean b)
public void setUseImplicitFileset(boolean useimplicitfileset)
Set this to false if you want explicit control with nested resource collections.
useimplicitfileset
- set to true if you want to use implicit filesetpublic void setXslResource(Resource xslResource)
xslResource
- Resource to set as the stylesheet.