|
Subject: Re: [xsl] Keeping result-document() from writing to a file more than once? From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 19 Apr 2019 08:45:14 -0000 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Keeping result-document(), Michael Kay mike@xxx | Thread | Re: [xsl] Keeping result-document(), Eliot Kimber ekimber |
| Re: [xsl] Keeping result-document(), Michael Kay mike@xxx | Date | Re: [xsl] Keeping result-document(), Eliot Kimber ekimber |
| Month |