xsl-list
[Top] [All Lists]

Re: [xsl] import, xslt 2.1

2010-03-15 03:46:49
On 15/03/10 08:07, Dave Pawson wrote:
On 15/03/10 04:52, Max Toro wrote:
You can use a custom URIResolver to load xsl imports/includes.
--
Max

I used an Oasis catalog in the end.
Same effect, less work :-)


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.

cp=.:/myjava/saxon9he.jar:/myjava/xercesImpl.jar:/myjava/resolver.jar

f=false

    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'









regards

--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>