public class Xslt extends java.lang.Object
-xslt:TRANSFORMER
determines, which Transformer is used. The default-value is net.sf.saxon.TransformerFactoryImpl
,
therefore this Transformer is recommended to use. It should be provided by the adequate jar-File
specified in the java's-CLASSPATH.
< root>
root-Element. It means, the translation file have to be regard
this additional < root>
root-Element. Write:
< xsl:apply-templates match="/root" > ....instead the often used
< xsl:apply-templates match="/" > ....
XmlExtensions
contains
a static method org.vishia.xml.XmlExtensions.readXmlFileTrimWhiteSpace(File)
which is used here
if an input is designated with the cmdLine option -j:FILE
.
WikistyleTextToSimpleXml
is implemented instead in the ZBNF2Xml-conversion (class ZbnfXmlOutput
and in the class CorrectHref
for documentation generation.
It was contained here in the past. It isn't supported yet, because the conversion routine
is changed using the XmlNode
, which is not directly compatible with JDOM.
An adaption is existing in the XmlNodeJdom
, but it isn't used here yet.
org.vishia.xml.XmlExtensions.writeXmlBeautificatedTextFile(Element, File, Charset)}
.
This writer uses JDOM as input. This is the older implementation.
A newer implementation of this feature is present in SimpleXmlOutputter
.Modifier and Type | Class and Description |
---|---|
protected class |
Xslt.Parameter |
Modifier and Type | Field and Description |
---|---|
protected boolean |
bWikiFormat
Set on command line option.
|
protected java.util.List<Xslt.Parameter> |
params |
protected java.lang.String |
sFileOut
Cmdline-argument, set on -y option.
|
protected java.lang.String |
sFileXslp
CmdLine-argument set on -p option: XSLT-File pre-converted with
Xsltpre . |
protected java.lang.String |
sFileXslt
CmdLine-argument set on -t option: XSLT-File for Transformer.
|
protected java.lang.String |
sTransformer
Class which is used by the javax.xml.transform.TransformerFactory
It is set with System.setProperty("javax.xml.transform.TransformerFactory", ...);
|
static java.lang.String |
sVersion
Version, history and license.
|
protected XmlMReader |
xmlMReader
Instance to process input files.
|
Constructor and Description |
---|
Xslt(java.lang.ClassLoader javacpArg,
java.lang.String sXmlReader,
java.lang.String sXmlTranslator)
Instantiation for Using in a Java/JZcmd-context.
|
Modifier and Type | Method and Description |
---|---|
void |
addInputfile(java.lang.String sFile)
Adds an input file with standard handling.
|
void |
addInputfileExpandWikiformat(java.lang.String sFile)
Adds an input file wich's content is expand as Wikiformat if the tag TODO.
|
void |
addInputfileReplaceWith1Space(java.lang.String sFile)
Adds an input file wich's white spaces are replaced by 1 space.
|
static java.lang.String |
exec(java.lang.String[] sArgs)
Invocation from another java program without exit the JVM
|
static void |
main(java.lang.String[] sArgs)
main started from java.
|
void |
setOutputfile(java.lang.String sFile) |
void |
setXslpfile(java.lang.String sFile) |
void |
setXsltfile(java.lang.String sFile) |
void |
transform()
Reads the input files and executes the transformation.
|
protected boolean bWikiFormat
protected java.util.List<Xslt.Parameter> params
protected java.lang.String sFileOut
protected java.lang.String sFileXslp
Xsltpre
.
If it is null, the is used as input.
.
NOTE: If the XSLT-File given in sFileXslt
-
element is newer as this given file, the first one will not overwritten by this given file. This feature
may be able to use for fine adjustments of content while debugging a script.protected java.lang.String sFileXslt
sFileXslp
is given, it is the name of the output file.protected java.lang.String sTransformer
public static final java.lang.String sVersion
Xslt(ClassLoader, String, String)
and transform()
to invoke from Java context with a different ClassLoader, used in JZcmd
protected XmlMReader xmlMReader
public Xslt(java.lang.ClassLoader javacpArg, java.lang.String sXmlReader, java.lang.String sXmlTranslator) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
javacp
- The Loader where the reader and translator should be found,
null if they are in the same Java classpath as this.sXmlReader
- "package.path.Class" of instanceof XmlMReader
. That is a multi XML reader.sXmlTranslator
- "package.path.Class" of instanceof TransformerFactory
.java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
public void addInputfile(java.lang.String sFile)
sFile
- public void addInputfileExpandWikiformat(java.lang.String sFile)
sFile
- public void addInputfileReplaceWith1Space(java.lang.String sFile)
sFile
- public static java.lang.String exec(java.lang.String[] sArgs)
sArgs
- same like main(String[])
public static void main(java.lang.String[] sArgs)
"invoke { -[i|j|k]:INPUT } [-t:XSLT] [-p:XSLP] -y:OUTPUT [-xslt:TRANSFORMER]"); "-i:INPUT-XML-file"); "-j:INPUT-XML-file, Whitespaces will replaced with 1 space"); "-t:XSLT: xsl-script XML2-compatible, it is output if -p:XSLP is given"); "-p:XSLP: Script pretranslated with Xsltpre, than -t:XSLT will be created if older."); " If no option -t:XSLT is given, XSLT will be created parallel with .xsl as extension."); "-y:OUTPUT-file"); "-xslt:TRANSFORMER Set the class for Transformer-Implementation. Default is " + sTransformer);
public void setOutputfile(java.lang.String sFile)
public void setXslpfile(java.lang.String sFile)
public void setXsltfile(java.lang.String sFile)
public void transform() throws javax.xml.parsers.ParserConfigurationException, java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerException, XmlException
addInputfile(String)
,
setXsltfile(String)
or setXslpfile(String)
#setOutfile(String)
.
javax.xml.parsers.ParserConfigurationException
java.io.IOException
SAXException
java.io.FileNotFoundException
javax.xml.transform.TransformerException
XmlException