Geert Bormans wrote:
Correct, I will maintain them separately of course,
but my customer has to fit the chain in, in an application that is not
to be touched.
I will deliver in seperate stylesheets, but I would like to have some
backup if the importing should fail, caused by path issues eg.
(I have no control over the execution environment)
Considering Colin's remarks, about xsl:next-match etc, it is an exercise
which may be next to impossible (at least far from trivial), but I maybe
wrong...
Can you change the URIResolver? Because if you can, you can place all
stylesheets into one stylesheet, id them (with xml:id), use use-when on
them so they won't be called prematurely, and let the URIResolver
resolve to parts of the same stylesheet (the id'ed parts). Probably the
easiest to do (if this is an option at all) to use your own scheme so
any existing schemes are not messed with. If XSLT 2.0 weren't too
strict, you would have an easy solution as follows (which illustrates my
idea, hopefully the indentation isn't messed with by my Thunderbird...):
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:include="http://include"
extension-element-prefixes="include">
<xsl:import href="multiple-stylesheets-in-one.xslt#include-me" />
<xsl:template match="/">
<xsl:text>text-main</xsl:text>
</xsl:template>
<include:stylesheet use-when="0">
<xsl:stylesheet xml:id="include-me" version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:text>text-include</xsl:text>
</xsl:template>
</xsl:stylesheet>
</include:stylesheet>
</xsl:stylesheet>
Saxon will throw an "A stylesheet cannot import itself" error, even
though you aren't really importing oneself. Which is why you will have
to come up with your own scheme, or a location of your stylesheet which
is not recognized by the processor as being the same:
<xsl:import
href="http://otherhost-to-same-location/multiple-stylesheets-in-one.xslt#include-me"
/>
but I don't know (not tested), if the #-syntax is supported this way (I
remember a few W3C notes on the subject, but I can't recall whether it
is legal and whether only the node with "include-me" will get selected).
I'd be curious if this is a feasible path for you, if so, we can
elaborate a bit on it.
Cheers,
-- Abel Braaksma
PS: without the xsl:import the use of xsl:stylesheet inside the
extension element is legal (at any other place it wouldn't), it is
ignored by the XSLT processor.
--~------------------------------------------------------------------
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>
--~--