xsl-list
[Top] [All Lists]

Re: [xsl] Context node versus current streaming position

2014-01-31 04:44:30

It's also possible, of course, for the context item to be in a completely 
different document, or to be an atomic value:

<xsl:stream href="data.xml">
   <xsl:for-each select="/root/element">
     <xsl:analyze-string select="." regex="....">
        ....

I haven't actually got any tests for that case yet, so I don't know if it will 
work in Saxon.

Michael Kay
Saxonica


On 31 Jan 2014, at 10:34, Costello, Roger L. <costello(_at_)mitre(_dot_)org> 
wrote:

Hi Folks,

I learned something neat from Michael Kay.

I learned that context node and current streaming position are not always the 
same.

Suppose the XSLT processor is streaming through an input document and has 
arrived at element N. The <N> element  is the current streaming position.

Now suppose the XSLT program instructs the XSLT processor: from your current 
streaming position climb the XML tree and return the name of each ancestor 
element:

      <xsl:for-each select="ancestor::*">
          <xsl:value-of select="name(.)" />
      </xsl:for-each>

The context position changes with each iteration of the for-each statement. 
But the current streaming position remains the same.

This is a key concept!

/Roger

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>