[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Keeping result-document() from writing to a file m

Subject: Re: 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
Re:  Keeping result-document() from writing to a file m
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.