[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

Subject: XSLT 3.0: What is the correct "Deep Skip" template rule code ?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 2 Jan 2015 21:08:07 -0000
 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
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"/>

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

     <xsl:template match="." mode="M"/>

Dimitre Novatchev

Current Thread


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.
First Name
Last Name
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.