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

RE: simulating conditional <xsl:include> behavior?

Subject: RE: simulating conditional <xsl:include> behavior?
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Wed, 3 Nov 1999 10:17:19 -0000
xsl include conditional
> What I would like to do is the equivalent of wrapping 
> <xsl:include> in an <xsl:if> or <xsl:for-each>. I want to pull into my
stylesheet 
> certain XSLT templates only when certain conditions are true -- namely, 
> the presence of certain data in a source document. 

This is going to be tricky, because generally the stylesheet will be read
and analysed before the source document is read (e.g. the processor will
generally read the xsl:strip-space and xsl:preserve-space elements before it
builds the source document tree; certainly it needs to read them before
evaluating any XPath expressions, because they can affect the result).

One thing you could try is to use external entity references in the
stylesheet instead of <xsl:include> (or perhaps in conjunction with
xsl:include). You could filter the SAX event stream used by the XSL
processor to read the stylesheet, and your filter could resolve the external
entity references based on any information it has to hand, including, if you
can afford the performance hit, reading the source document.

In SAXON, if you're not scared of getting into the guts, you could define an
extension element my:include, make the implementation class that supports it
a subclass of the one that supports xsl:include, and thus again use your own
logic to decide whether or not to invoke the superclass behaviour. But it
still wouldn't have access to the source document at this stage of
processing.

Mike Kay





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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-2013 All Rights Reserved.