org.vishia.xmlSimple
Class Xsltpre
java.lang.Object
org.vishia.xmlSimple.Xsltpre
public class Xsltpre
- extends java.lang.Object
This class is the wrapper for the command line invokation of a XSLT preprocessor
for text output. The intension of preprocessing a XSLT script is shown in followed:
For text output, it is convenient for software support to write the lines
in XSL script in the order of the output file. But if some informations from XML
are merged in them, the necessitative expression may be a little long and not clearly.
A short form will be better.
The class converts the given script line per line, it is a simple displacement
of textual parts, combined with the possibility of alias names especially for
XPATH expressions.
The key strings of special expressions begin with the <-character like XML,
but followed by a special character outside the XML possibilities. So it is
plain detectable by human in the script and non-ambiguous detectable by the conversion routine.
The followed expressions will be detected and converted:
(?=ident=XPATH?)
| The XPATH expression is stored and assigned to the alias ident.
|
(?!path?)
| Value of the element or attribut given by expression. path
is either a XPATH expression or, if starting with = an alias representing a XPATH.
The resulting code in XSLT is:
</xsl:text><xsl:value-of select="path" /><xsl:text>
|
(?:name[:path](parameter=value, ...)?)
| call of the named template name with selecting
the path before, with the named parameter
with theire given value.
- The
path should be written in "" if it is given directly.
The path may be given also as alias, if started with =.
-
The
value of the parameters may be given as followed:
| *xpath
| A XPATH expression
|
| =alias
| A XPATH expression given with the alias
|
| 'text'
| A constant text expression.
|
- Some expressions may be concated with " + ". See example.
If no parameter are given, write
(). Separate parameters with a colon ,.
- The resulting code in XSLT is:
</xsl:text><xsl:for-each select="path">
<xsl:call-template name="name">
<xsl:with-param name="parameter">...(value)</xsl:with-param>
</xsl:call-template>
<xsl:text>
If no path is given by writing <:path:name(...,
no <xsl:for-each ... wrapping is done.
|
Example:
The code (TODO!!!)
(?=myPath=element1/element2/@value?)
...<xsl:text>
The text with info:(?@=myPath?) and info2:(?@attrib?) is written
with (?:callname()?) and with (?:callname2:"callpath"(par1='text' + xxx)?)</xsl:text>
is converted to
... TODO
|
Constructor Summary |
Xsltpre(java.io.File fIn,
java.io.File fOut)
|
|
Method Summary |
void |
execute()
Generate the output file, but only if it is older as the input, or it don't exists,
or bGenerateAlways is set to true. |
static void |
main(java.lang.String[] args)
main started from java |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Xsltpre
public Xsltpre(java.io.File fIn,
java.io.File fOut)
execute
public void execute()
- Generate the output file, but only if it is older as the input, or it don't exists,
or bGenerateAlways is set to true.
main
public static void main(java.lang.String[] args)
- main started from java