[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: import, xslt 2.1

Subject: Re: import, xslt 2.1
From: Dave Pawson <davep@xxxxxxxxxxxxx>
Date: Mon, 15 Mar 2010 08:44:51 +0000
Re:  import
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.