EXSLT - set:trailing

Implementer Page: set.trailing.html
Function Package: set.trailing.zip

Function Syntax

node-set set:trailing(node-set, node-set)

Template Syntax

<xsl:call-template name="set:trailing">
   <xsl:with-param name="nodes" select="node-set" />
   <xsl:with-param name="node" select="node-set" />
</xsl:call-template>

The set:trailing function returns the nodes in the node set passed as the first argument that follow, in document order, the first node in the node set passed as the second argument. If the first node in the second node set is not contained in the first node set, then an empty node set is returned. If the second node set is empty, then the first node set is returned.

The set:trailing template applies templates to these nodes in set:trailing mode. By default, the nodes are copied by this template, so that a result tree fragment consisting of the nodes is returned.

Implementations

The following XSLT processors support set:trailing:

Implementations of set:trailing are available in the following languages:

Examples

Function

The following example shows how to use the set:trailing function:

Source

<doc>
   <a />
   <b />
   <c />
   <d />
   <e />
   <f />
   <g />
   <h />
</doc>

Stylesheet

<xsl:template match="doc">
   <out>
;
            <xsl:value-of select="count(set:trailing(*, d))" />
;
            <xsl:value-of select="count(set:trailing(*, b|d|f))" />
;
            <xsl:value-of select="count(set:trailing(*, a|f|h))" />
;
            <xsl:value-of select="count(set:trailing(*, x))" />
;
            <xsl:value-of select="count(set:trailing(x, *))" />
;
            <xsl:value-of select="count(set:trailing(d|e|f, a|e))" />
;
    
   </out>
</xsl:template>

Result

<out>;
      4;
      6;
      7;
      8;
      0;
      0;
    </out>

http://www.exslt.org/set/functions/trailing/index.html last modified 2002-11-12