Re: import, xslt 2.1
On 15/03/10 04:52, Max Toro wrote:You can use a custom URIResolver to load xsl imports/includes. -- Max
On the conditional import, Andrew gave me the following solution, may be of use to others and explain how use-when works.
I'm on Linux, so my shell is bash. OS environmental variables are set using set varname=value
to use this idea, I want to set an OS environmental variable, copy that to a Java System Property (sort of an environmental variable where the environment is Java?) then pass that into the stylesheet.
My shell script looks like this.
java -cp $cp:. -Df=$f net.sf.saxon.Transform \ -x org.apache.xml.resolver.tools.ResolvingXMLReader \ -y org.apache.xml.resolver.tools.ResolvingXMLReader \ -r org.apache.xml.resolver.tools.CatalogResolver -o $3 $1 $2
Note the continuation lines ending in \
f is the OS env var passed into the java executable using -Df=$f, which assigns the system property 'f' to the env var f then in the stylesheet I use
<xsl:import href="/sgml/test/junit.xsl" use-when="system-property('f')='true'" />
which only works when the OS env variable is set to 'true'
-- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format