| (Q16) Prepare a "critical sequence" report consisting of all elements that occur between the first and second incision in
                  the first procedure.
               
<critical_sequence>
   LET $p := //procedure[1]
   FOR $e IN //* AFTER ($p//incision)[1] 
          BEFORE ($p//incision)[2]
   RETURN shallow($e)
</critical_sequence>
XSLT equivalent to (Q16)
<critical_sequence xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:variable name="p" select="(//procedure)[1]"/>
  <xsl:variable name="before" select="$p//incision[2]/preceding::*"/>
  <xsl:variable name="after" select="$p//incision[1]/following::*"/>
  <xsl:variable name="between" select="$before[count(.|$after)=count($after)]"/>
  <xsl:for-each select="$between">
    <xsl:copy/>
  </xsl:for-each>
</critical_sequence>
                  
                  The XSLT solution is not as intuitive. It uses the XPath axes on document order, namely precedingandfollowing. It then gets the intersection of two node-sets. XSLT 2.0 promises to include better, more intuitive support for set operations. |