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

Subject: Re: [xsl] are there non streaming use cases of fn:snapshot function
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Mar 2019 06:30:50 -0000
Am 15.03.2019 um 07:07 schrieb Mukul Gandhi gandhi.mukul@xxxxxxxxx:
Hi all,
B B I've read the XSLT 3.0 spec forB 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()">

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

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

B </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.

Current Thread