Re: [xsl] stylesheet expansion

Subject: Re: [xsl] stylesheet expansion
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: Wed, 26 Dec 2007 16:31:39 +0000
    Abel> I am under the impression that step nr (5) should not be
    Abel> necessary, as you technically do not include the (whole)
    Abel> same stylesheet (giving you error XTSE0210: "A stylesheet
    Abel> cannot import itself"), but well, it's what the specs say I
    Abel> guess. To fool the processor we need a trick: the junction
    Abel> point/hard link. Alternatives are: using a http location
    Abel> (different FQDN name) or a local machine name named
    Abel> differently (i.e., through the hosts file).

Having read the spec. I'm under the impression that you do not need to
resort to such a trick. Nor indeed hard-code the imports (which make
the transformation immobile).

So I reduced the length of the hrefs, and saved imports.xsl as:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
   <xsl:import href="#include-me1" />
   <xsl:import href="#include-me2"/>
   <xsl:template match="/">
       <xsl:apply-imports />

   <include:stylesheet use-when="0">
                   <xsl:output omit-xml-declaration="yes" />
                   <xsl:template match="/">
   <include:stylesheet use-when="0">
                   <xsl:template match="/">
               <xsl:next-match />


gestalt imports.xsl hello-world.xml



So no junction/link trick is necessary with Gestalt.

Of course, using fragment identifiers is not reliable, as this is
implementation-defined behaviour.

It works on Gestalt, as it supports XPointer syntax (shorthand
pointers and element() scheme), on the assumption that the media type
is application/xml and that XPointer is applicable to this media type
(suppressable with an option). I see that this option may no longer be
necessary, as the wording now specifically says XPointer may be supported.

I then tried it on Saxon 9. It reports error XTSE0210, so I guess
Dr. Kay is ignoring the fragment identifier for the purposes of
XTSE0210. I guess it can be argued either way with that wording, and
perhaps it is deliberately ambiguous. The main point is that you don't
get an infinite recursion whilst compiling.

P.S. match="/" rather than a name="something"? Not my style (it's also
slightly inefficient, depending upon the size of the dummy document).
Colin Adams
Preston Lancashire

Current Thread