Project

Profile

Help

xsl:merge-source for-each-source, streamable="yes" and Sa... » test-merge-snapshot5.xsl

Martin Honnen, 2018-09-28 15:08

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
version="3.0">
<xsl:output indent="yes"/>
<xsl:mode on-no-match="shallow-copy"/>
<xsl:template name="xsl:initial-template" match="/">
<result-root>
<xsl:merge>
<xsl:merge-source for-each-source="'input1.xml'" select="*/*/*" streamable="yes">
<xsl:merge-key select="true()"/>
</xsl:merge-source>
<xsl:merge-action>
<merge-group position="{position()}">
<xsl:apply-templates select="current-merge-group()"/>
</merge-group>
</xsl:merge-action>
</xsl:merge>
</result-root>
</xsl:template>
<xsl:template match="/*/*/*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="position" select="position()"/>
<xsl:attribute name="sibling-count" select="count((preceding-sibling::*, following-sibling::*))"/>
<xsl:apply-templates/>
</xsl:copy>
<xsl:assert test="count((preceding-sibling::*, following-sibling::*)) = 0">Snapshot created by merge has siblings</xsl:assert>
</xsl:template>
</xsl:stylesheet>
(2-2/2)