| ZVON > Tools > Saxonserver |
| Intro / Search / ZVON |
This "documentation" has been written by Jiri Jirat, any comments and questions send to him, please.
Warning, use of this software can represent a security risk, see Security section.
This tool is for Linux users, who very often call Saxon (XSLT processor) from command line and are bothered by slow start of Java. Saxonserver is a server, which gets data directly via TCP and performs XSLT transformation using saxon. Saxonclient is a perl script, which sends the filenames or URLs of XML and XSLT files, and pairs of parameters to the server. The only purpose is to avoid starting Java with each transformation, which represents a constant delay about 2 - 3 seconds. Thus when you perform one thousand transformations you can save nearly one hour of your precious time.
Saxonserver is primarily for LINUX users (where you can't use Instant Saxon and Java is very slow to start). You need:
There are two versions:
Mandatory screenshot :-) Notice the time needed for transformation.
Warning! If you are not behind firewall, there is a possible security threat, because someone else can execute a remote stylesheet, which can use Saxon (or Java) extensions with very detrimental effects.
For your convenience, we have added Saxon (saxon.jar) and compiled Java classes to the distribution.
Follow the steps below:
$ cd /mysoft
$ tar xovzf fastsaxon_standardDOM.tgz
$ cd fastsaxon_standardDOM
$ ./saxonserver
~/bin,
and it is ready to run.
Invoking "saxonclient" is very similar to running saxon from command line:
$ saxonclient [-o output] source-doc style-doc {param=value}...
No other options are supported (I think).
Example:
saxonclient -o out.html a.xml test.xsl
Important difference occurs when using relative path
to files in
xsl:document or saxon:output,
because here the filenames are relative to XSLT processor,
not stylesheet (see Saxon documentation).
Thus if you use the following construct:
<xsl:document href="Output/out.html"> ... </xsl:document>it will create file "out.html" in directory "Output", which is subdirectory of saxonserver's directory (e.g. /mysoft/fastsaxon_standardDOM/Output/out.hml) and not of your working path!
We use the following approach - send your working path to the stylesheet as a parameter.
saxonclient -o out.html a.xml test.xsl pwd=${PWD}/
And in the stylesheet you paste the value of parameter "pwd"
in front of the output filename.
<xsl:stylesheet ..>
<xsl:param name="pwd"/>
<xsl:template match="/">
<xsl:document href="{$pwd}Output/out.html">
...
</xsl:document>
</xsl:template>
</xsl:stylesheet>
The advantage of this approach is that it behaves exactly
as ordinary saxon without sending the parameter "pwd"
(because its implicit value is empty).
There is no support. If you make any enhancements, we will be grateful if you share them. Proposals to improve this "documentation" send to me (Jiri.Jirat@systinet.com), please.
Saxonserver and saxonclient have been written by Miroslav Simek (with contributions from others). If you find this utility useful, drop him a line with your thanks, please.
This material has been developed for Zvon, where you can find other not only XML related materials (both basic and advanced tutorials and references about XSLT, XML, DTD, Mozilla, CSS, schemas, regular expressions, ...)
This material can be downloaded for off-line use.
Partner sites:
Code Project, DevelopersDex, DevGuru, Programmers Heaven, Search Us at TopXML!, Search Us at ZVON!, Tek-Tips Forum, TopXML, VisualBuilder.com, W3Schools, XMLPitstop
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections with the no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License"
The programs used to prepare this reference are covered by GNU General Public License"