|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tools.ant.ProjectComponent org.apache.tools.ant.Task net.sf.fikin.ant.XsltTask
public class XsltTask
Main differences are:
Xslt
objectlocation="..."
instead of
expression="..."
for parameteres and attibutes. This allows
for up-to-date dependency checking and also passing these values as URLs
instead of simple file names. Last is required by Xalan when the xslt
parameter is document location.
Nested Class Summary | |
---|---|
class |
XsltTask.Factory
The factory element to configure a transformer factory |
Field Summary | |
---|---|
protected java.util.Vector |
depends
extra files this transfrmation is dependent to |
protected XsltTask.Factory |
factory
factory element for TraX processors only |
protected boolean |
failOnError
fail on error during transformation, by default true |
protected org.apache.tools.ant.util.FileUtils |
fileUtils
Utilities used for file operations |
protected boolean |
force
force output of target files even if they already exist |
protected java.util.Vector |
inFilesets
input xml documents |
protected org.apache.tools.ant.types.Mapper |
mapperElement
Mapper to use when a set of files gets processed |
protected java.util.Vector |
params
transformation parameters |
protected java.util.Hashtable |
paramsHT
internal member, used to represent parmas in hashtable format |
protected boolean |
reuseLoadedStylesheet
whether to reuse Transformer if transforming multiple files |
protected java.io.File |
xslFile
xslt to be used for the transformation |
protected Xslt |
xslt
internal member used to refernence reusable Xslt object |
Fields inherited from class org.apache.tools.ant.Task |
---|
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
project |
Constructor Summary | |
---|---|
XsltTask()
|
Method Summary | |
---|---|
void |
add(org.apache.tools.ant.util.FileNameMapper fileNameMapper)
A nested filenamemapper |
void |
addFileset(org.apache.tools.ant.types.FileSet set)
Adds a set of files to copy. |
protected void |
check()
do a checking on the set parameters |
Depends |
createDepends()
Create an instance of an XSL parameter type "depends" for configuration by Ant. |
XsltTask.Factory |
createFactory()
Create the factory element to configure a trax liaison. |
org.apache.tools.ant.types.Mapper |
createMapper()
Defines the mapper to map source to destination files. |
XsltParam |
createParam()
Create an instance of an XSL parameter for configuration by Ant. |
void |
error(javax.xml.transform.TransformerException exception)
callback from XSLT when some error |
void |
execute()
execute the transformation |
void |
fatalError(javax.xml.transform.TransformerException exception)
callback from XSLT when some fatal error |
protected java.io.File |
getOutFile(java.io.File inFile)
determine output file name for the given inout name |
protected java.util.Hashtable |
getParams()
return hashtable with all transformation params (convert them from Vector) |
protected java.util.Hashtable |
getParams(java.util.Enumeration e)
create a new hashtable with all elements |
protected Xslt |
getXslt()
instantiate (if needed) an xslt object and return it it would be one an same object if xslt is to be reused |
protected boolean |
isUpToDate(java.io.File in,
java.io.File out)
check if timestamp is up to date for input, output and depends and param-locations |
protected javax.xml.transform.TransformerFactory |
newStyleFactory()
instantiate a new factory and set the attributes |
protected Xslt |
newXslt()
instantiate a new xslt object |
protected void |
scan(org.apache.tools.ant.types.FileSet fs)
scan a fileset and process each individual file |
void |
setFailOnError(boolean flg)
Set whether to abort the execution in case of error during xslt, by default is true |
void |
setForce(boolean force)
Set whether to check dependencies, or always generate; optional, default is false. |
void |
setIn(java.io.File inFile)
specifies a single XML document to be styled. |
void |
setOut(java.io.File outFile)
Specifies the output name for the styled result from the in attribute; required if in is set |
void |
setReloadStylesheet(boolean b)
Controls whether the stylesheet is reloaded for every transform. |
void |
setStyle(java.io.File xslFile)
Name of the stylesheet to use - given either relative to the project's basedir or as an absolute path |
protected void |
transform(java.io.File inFile)
transform an input file |
protected void |
transform(java.io.File in,
java.io.File out)
transform input into output |
void |
warning(javax.xml.transform.TransformerException exception)
callback from XSLT when some warning |
Methods inherited from class org.apache.tools.ant.Task |
---|
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
getProject, setProject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Vector inFilesets
protected org.apache.tools.ant.types.Mapper mapperElement
protected java.io.File xslFile
protected boolean failOnError
protected boolean force
protected boolean reuseLoadedStylesheet
protected org.apache.tools.ant.util.FileUtils fileUtils
protected XsltTask.Factory factory
protected java.util.Vector params
protected java.util.Vector depends
protected java.util.Hashtable paramsHT
protected Xslt xslt
Constructor Detail |
---|
public XsltTask()
Method Detail |
---|
public void setOut(java.io.File outFile)
outFile
- the output File instance.public void setIn(java.io.File inFile)
inFile
- the input filepublic void setStyle(java.io.File xslFile)
xslFile
- the stylesheet to usepublic void addFileset(org.apache.tools.ant.types.FileSet set)
set
- a set of files to copypublic org.apache.tools.ant.types.Mapper createMapper() throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
- if more than one mapper is definedpublic void add(org.apache.tools.ant.util.FileNameMapper fileNameMapper)
fileNameMapper
- the mapper to addpublic void setFailOnError(boolean flg)
flg
- abort execution if truepublic void setForce(boolean force)
force
- true if always generate.public void setReloadStylesheet(boolean b)
Setting this to true may get around a bug in certain Xalan-J versions, default is false.
public XsltParam createParam()
public Depends createDepends()
public XsltTask.Factory createFactory() throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
- if the element is created more than one time.public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- in case of errorprotected void check() throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
protected void scan(org.apache.tools.ant.types.FileSet fs)
fs
- protected void transform(java.io.File inFile)
inFile
- protected java.io.File getOutFile(java.io.File inFile)
inFile
-
protected boolean isUpToDate(java.io.File in, java.io.File out)
in
- out
-
protected void transform(java.io.File in, java.io.File out) throws org.apache.tools.ant.BuildException
in
- out
-
org.apache.tools.ant.BuildException
protected Xslt getXslt() throws java.io.FileNotFoundException, javax.xml.transform.TransformerConfigurationException, java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException
java.io.FileNotFoundException
javax.xml.transform.TransformerConfigurationException
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
protected java.util.Hashtable getParams()
protected java.util.Hashtable getParams(java.util.Enumeration e)
e
- is a list of Parameter objects
protected Xslt newXslt() throws java.io.FileNotFoundException, javax.xml.transform.TransformerConfigurationException, java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException
java.io.FileNotFoundException
javax.xml.transform.TransformerConfigurationException
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
protected javax.xml.transform.TransformerFactory newStyleFactory() throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
public void warning(javax.xml.transform.TransformerException exception) throws javax.xml.transform.TransformerException
warning
in interface javax.xml.transform.ErrorListener
javax.xml.transform.TransformerException
public void error(javax.xml.transform.TransformerException exception) throws javax.xml.transform.TransformerException
error
in interface javax.xml.transform.ErrorListener
javax.xml.transform.TransformerException
public void fatalError(javax.xml.transform.TransformerException exception) throws javax.xml.transform.TransformerException
fatalError
in interface javax.xml.transform.ErrorListener
javax.xml.transform.TransformerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |