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

Re: xsl/xslt coding standard

Subject: Re: xsl/xslt coding standard
From: Steve Ball <Steve.Ball@xxxxxxxxx>
Date: Mon, 19 Aug 2002 10:44:37 +1000
ball book in doc format
Hi Jeni,

You wrote:
If exclude-result-prefixes works OK, why introduce something new?

exclude-result-prefixes doesn't work OK, or at least it doesn't work OK if (a) you want to put documentation *within* templates and (b) you don't want to have to nest it inside an instruction that guarantees it won't be processed [such as an xsl:if test="false()" or an xsl:for-each select="/.."].

OK. I understand the problem now.


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@xxxxxxxxx  +---------------------------+---------------------
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



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.