RE: How is this part of the XSLT specification to be interpreted?

Subject: RE: How is this part of the XSLT specification to be interpreted?
From: "Pawson, David" <DPawson@xxxxxxxxxxx>
Date: Thu, 22 Jun 2000 08:39:47 +0100
Jeni Tennison 

>Now I'm confused! :) 

After this latest epistle, I'm far less confused. Thanks Jeni.

Assumption:
1. The overall goal of the stylesheet is to output the transformed input,
sans documentation.
2. We get at the documentation via a second transform of the stylesheet.

(Is that the way Knuth did it?)

Hi points (for me)


>When an extension-element-aware (and XSLT-Recommendation-compliant)
>processor comes across this, it knows (because it's been told in the
>xsl:stylesheet) that the 'doc:template' element, being in the 'doc'
>namespace, is an extension element.  It does a bit of introspection and
>finds out that it doesn't know how to support these 
>extensions, so it gets
>ready to complain that it can't process the stylesheet, but 
>first checks
>whether there is an xsl:fallback element within the extension element.
>When it finds one, it operates on the content of the 
>xsl:fallback as if it
>were just a normal part of the template (here it's empty, so it does
>nothing), and ignores the rest of the content of the extension element.
>Hence the documentation is not included in the output.

(I have an image of a frustrated processor all ready to bomb,
and not being able to ;-)


>include in it.  There is no point in doing:
>
>  <doc:template><xsl:fallback />
>    This template matches <xsl:value-of select="name()" />.
>  </doc:template>
>
>because the xsl:value-of element is never processed (by an 
>XSLT processor
>that doesn't understand doc:template).

The point that David C made re my input. Thanks Jeni.


>on.  So, you
>could use:
>
>  <xsl:template match="...">
>    <doc:template>
>      <!-- documentation on the template -->
>      <xsl:fallback>
>        <!-- body of the template -->
>      </xsl:fallback>
>    </doc:template>
>  </xsl:template>
>
>as the design pattern for including documentation instead.  In 
>a previous
>email, I've pointed out that this probably isn't a good idea 
>just in case
>some XSLT processor comes along that *does* understand the 
>'doc:template'
>extension element, because then the content of the xsl:fallback element
>(which is the content of the template) will not be processed, and your
>legacy stylesheet won't work. 

Statistically small chance? But Murphies law being what it is.....


>
>The point, of course, of using XML to represent the 
>documentation within
>the stylesheet is that you can get at it with things that 
>understand XML,
>most importantly XSLT.  So, you can then have another XSLT 
>stylesheet that
>takes our documented XSLT stylesheet as input and produces a nice HTML
>frameset that explain what the stylesheet does and how it 
>works.

Stylesheet that operates on our Knuthian stylesheet and outputs
HTML. OK.... I'd missed that one totally.
Hence the schema for documentation, to permit this to be 
'standardised'?


I think I'm with this little lot now, sufficiently to use in the faq.

Many thanks Jeni. 

A side effect of my erroneous input is that we now have 
a clearly described documentation method. Mmmm.

I'll try again, and check off line before posting <grin/>


Regards, DaveP


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


Current Thread