[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSLT 3.0: What is the correct "Deep Skip" template rul
Let me start with wishing to everyone a Happy and Safe New Year! To continue with more routine, daily stuff : In section "6.7.4 Built-in Templates: Deep Skip" of the 2nd Last Call of the W3C "XSLT 3.0" specification (http://www.w3.org/TR/2014/WD-xslt-30-20141002/#built-in-templates-deep-skip), we read: 'The effect of processing a tree using a mode that specifies on-no-match="deep-skip" is that where no explicit template rule is specified for an element, that element and all its descendants are ignored, and are not copied to the result tree. The effect of choosing on-no-match="deep-skip" is as follows: The built-in rule for document nodes is equivalent to calling xsl:apply-templates with no select attribute, and with the mode attribute set to #current. If the built-in rule was invoked with parameters, those parameters are passed on in the implicit xsl:apply-templates instruction. In the case where there are no parameters, this is equivalent to the following rule: <xsl:template match="document-node()" mode="M"> <xsl:apply-templates mode="#current"/> </xsl:template> The built-in rule for all items other than document nodes (that is, for all other kinds of node, as well as atomic values and functions, including maps) is to do nothing, that is, to return an empty sequence (without applying templates to any children or ancestors). This is equivalent to the following rule: <xsl:template match="." mode="M"/> ' This definition raises some questions: 1. Why should there be inside a "deep skip" template, an <xsl:apply-templates> instruction? If the purpose is really "deep skip", isn't this most directly accomplished by: <xsl:template match="document-node()" mode="M"/> And why pass parameters, if they wouldn't be used at all? 2. Why are there two separate "deep skip" built-in templates -- one for matching document nodes and one for matching any item? Why not just have a single template that matches any item (document node included): <xsl:template match="." mode="M"/> -- Cheers, Dimitre Novatchev
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|