xsl-list
[Top] [All Lists]

Re: [xsl] are there non streaming use cases of fn:snapshot function

2019-03-15 01:31:15
Am 15.03.2019 um 07:07 schrieb Mukul Gandhi 
gandhi(_dot_)mukul(_at_)gmail(_dot_)com:
Hi all,
   I've read the XSLT 3.0 spec for fn:snapshot function. As stated in the spec, this function has lots of uses while using streaming, which is great.



I'm curious to know, what could be good non streaming use cases of fn:snapshot function ?


Well, whether you have streaming or not supported, snapshot makes splitting up files where you want to preserve the tree structure easy e.g.

<xsl:for-each select="//foo!snapshot()">

  <xsl:result-document href="foo{position()}.xml">

     <xsl:copy-of select="/"/>

  </xsl:result-document>

</xsl:for-each>

Without snapshot in XSLT 2 you would need to write templates to reconstruct the ancestor tree of the foo elements. It is not that hard with the help of tunnel parameters but using snapshot for sure results in more compact code.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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