If you can not detect (by some predicates in the input) that you are
in a duplicate then one way is to replace
<xsl:if test="not(doc-available($newFile))"
CREATE FILE NOW
<xsl:result-document method="xml" href="{$newFile}" indent="yes">
<referable-content id="ikj1555615661716" xml:lang="en-us">
<titler>efereable test</title>
<rcbody>
<xsl:copy-of select="document($srcFile)//*[@id = $target]"/>
</rcbody>
</referable-content>
</xsl:result-document>
</xsl:if>
by something like
<result-document href="{$newFile}" >
<referable-content id="ikj1555615661716" xml:lang="en-us">
<titler>efereable test</title>
<rcbody>
<xsl:copy-of select="document($srcFile)//*[@id = $target]"/>
</rcbody>
</referable-content>
</result-document>
so generating elements not writing files at this stage,
Then wrap your outer transformation in a file-writing pass replacing
<xsl:apply-templates/>
by
<xsl:variable name ="x">
<xsl:apply-templates/>
</xsl:variable>
<xsl:for-each-group select="$x//result-document" group-by="@href">
<xsl:result-document href="@href" indent="yes">
<xsl:copy-of select="node()"/>
</xsl:result-document>
</xsl:for-each-group>
David
--~----------------------------------------------------------------
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
--~--