XSLT 2.0 Proposal [Was: Re: [xsl] xsl/xslt coding standard]

Upon Jeni Tennison's advice, I am forwarding a
proposal I made a while back on the XSL-LIST
mailing list.

This is a counter-proposal to the documentation
element for handling inline documentation requirements
in XSLT stylesheets.  It is a more general approach
that allows removal of any element in a given namespace
prior to processing.

Regards,
Steve Ball

-------- Original Message --------
Subject: Re: [xsl] xsl/xslt coding standard
Date: Mon, 19 Aug 2002 10:44:37 +1000
From: Steve Ball <Steve.Ball@zveno.com>
Reply-To: xsl-list@lists.mulberrytech.com
Organization: Zveno Pty Ltd
To: xsl-list@lists.mulberrytech.com

How about another approach to the problem?  Generalise the
whitespace stripping process to also strip nominated
elements?  This may even have the benefit of improving
runtime performance by not having to skip over embedded
documentation elements during processing.

Proposal: In addition to <xsl:strip-space>, allow <xsl:strip-nodes>
This element requires a 'select' attribute.  Any node matching the
XPath expression given by the 'select' attribute is stripped
from the stylesheet, including its descendants.  The default
value is 'processing-instruction()|
text()[string-length(normalize-space()) = 0]'.  xsl:strip-space
and xsl:preserve-space modify the nodes to be stripped in the
obvious manner.

For example, to specify that embedded DocBook elements get
stripped:

<xsl:stylesheet version='1.0'
    xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
    xmlns:doc='http://www.docbook.org/documentation/1.0'>

    <xsl:strip-nodes select='doc:book|doc:article'/>

    <xsl:template match='/'>
      <p>This appears in the result</p>
      <doc:book xmlns=''>
        <title>Embedded Doco</title>
        <p>This does not appear in the result</p>
      </doc:book>
    </xsl:template>

</xsl:stylesheet>

-- 
Steve Ball            |   XSLT Standard Library   | Training & Seminars
Zveno Pty Ltd         |     Web Tcl Complete      |   XML XSL Schemas
http://www.zveno.com/ |      TclXML TclDOM        | Tcl, Web Development
Steve.Ball@zveno.com  +---------------------------+---------------------
Ph. +61 2 6242 4099   |   Mobile (0413) 594 462   | Fax +61 2 6242 4099


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

-- 
Steve Ball            |   XSLT Standard Library   | Training & Seminars
Zveno Pty Ltd         |     Web Tcl Complete      |   XML XSL Schemas
http://www.zveno.com/ |      TclXML TclDOM        | Tcl, Web Development
Steve.Ball@zveno.com  +---------------------------+---------------------
Ph. +61 2 6242 4099   |   Mobile (0413) 594 462   | Fax +61 2 6242 4099

Received on Thursday, 31 October 2002 04:36:30 UTC