xslutil.conversions
. Excerpts of
xslsrv/addon/config/xhtml/xslutil.conversions
(xslsrv/
being the unpacked
xslsrv.war
):<conversions xmlns="http://www.xmlmind.com/xslutil/schema/conversion"> <conversion name="xhtmlToPDF" description="Convert to PDF using Apache FOP" icon="icon:acroread" category="XHTML" categoryIcon="icon:xhtml_file" outputExtension="pdf"> <transform styleSheet="xsl/fo.xsl"> <parameter name="paper.type">A4</parameter> <!-- Needed to convert a remote URL rather than a local file. --> <parameter name="img-src-path">%~pi</parameter> </transform> <processFO processor="FOP"> <parameter name="renderer">pdf</parameter> <parameter name="strict-validation">false</parameter> </processFO> </conversion> </conversions>
xslutil.conversions
is not yet documented.
Fortunately, XMLmind XSL Utility , a user-friendly desktop
application allows to create and edit conversion specifications quickly
and easily.xslsrv/addon/
, where
xslsrv/
is the unpacked
xslsrv.war
,customize_dir/addon/
,
where customize_dir is the directory pointed to by
the customizeDir
server parameter, if any.xslutil.conversions
, which
contain conversion specifications and also for files whose basename ends
with "atalog.xml", which are XML
catalogs (1). The conversion specifications
collected during these stage are immutable. Moreover their number is
fixed, that is, adding or removing
xslutil.conversions
files to/from any of the two
addon/
directories will not be detected by XMLmind
XSL Server. We'll call this set the stock conversion
specifications.customize_dir/xslutil.conversions
,
which may contain redefinitions of some of the stock conversion
specifications and/or custom conversion specifications.xslsrv/WEB-INF/web.xml
(xslsrv/
being the unpacked
xslsrv.war
) ./opt/xslsrv/
. Use
a text editor and edit xslsrv/WEB-INF/web.xml
.
Give a value to the customizeDir
init-param.<init-param> <param-name>customizeDir</param-name><param-value>/opt/xslsrv</param-value> </init-param>
$ xslutil -p /opt/xslsrv &
/opt/xslsrv/
.$ ls /opt/xslsrv addon xslutil.conversions xslutil.properties
ImportantMake sure that the user account used to
run the Servlet Container (e.g. user: tomcat, group:
tomcat) has sufficient privileges to read the contents of the
directory pointed to by the customizeDir server
parameter.
|
TipXMLmind XSL Server can directly
use the user preferences directory of XMLmind XSL Utility. In other words,
no need to create a special purpose directory
(
/opt/xslsrv/ in the above examples) for
that.The user preferences directory of XMLmind XSL Utility
is:
Example (user: joe on Linux):
<init-param> <param-name>customizeDir</param-name><param-value>/home/joe/.xfc</param-value> </init-param> |
TipXMLmind XSL Server can directly use an existing Apache FOP configuration file.
The location
of an existing FOP configuration file may be specified to XSL Server by
the means of Java™ system property or environment variable
XXE_FOP_CONFIG. The value of this variable is an URL or
an absolute file path. Examples:
-DXXE_FOP_CONFIG=http://localhost/~john/fop/fop.conf
(Java™ system property),
set XXE_FOP_CONFIG=C:\Users\john\misc\fop\fop.conf
(Windows environment variable).You'll need to restart your Servlet
container after setting system property or environment variable
XXE_FOP_CONFIG.
|
(1) |
Let's suppose you
want to convert an XHTML document to RTF. The XHTML file starts
with:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> ... Without an XML catalog, xhtml1-transitional.dtd will be
downloaded from
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd in order
to be parsed, which will make the conversion really slow.
With the
following XML catalog,
xslsrv/addon/config/catalog.xml :<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public"> ... <public publicId="-//W3C//DTD XHTML 1.0 Transitional//EN" uri="xhtml/dtd/1.0/xhtml1-transitional.dtd"/> ... </catalog> It's the local copy of the DTD,
xslsrv/addon/config/xhtml/dtd/1.0/xhtml1-strict.dtd ,
which is going to be parsed. |