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

Accumulator use

Subject: Accumulator use
From: "cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Feb 2016 11:27:00 -0000
 Accumulator use
Hello ! 

I try to cache values who are in external files referenced from my
source file : 

source.xml
------------
<root><input href="1.xml"/><input href="2.xml"/>...</root> 

n.xml
------
<root type="typeN">...</root> 

I want to create a map(xs:anyUri, xs:string), where key is the external
file URI, and value is always /*/@type in the file 

External files may be huge, and I'd like to stream them. I create an
accumulator, stream input files using this accumulator. 

<xsl:accumulator name="acc" as="map(xs:string, xs:string)"
initial-value="map{}">
   <xsl:accumulator-rule match="*[@value]">
      <xsl:sequence select="map:put($value, ./local-name(),
xs:string(./@value))"/>
   </xsl:accumulator-rule>
</xsl:accumulator> 

<xsl:mode name="m" streamable="yes"/> 

<xsl:template match="/">
   <xsl:stream href="../../test/resources/entries.xml"
use-accumulators="acc">
      <xsl:apply-templates mode="m"/>
   </xsl:stream>
   <!-- do here something that uses the accumulator -->
</xsl:template> 

How can I access to the accumulator after stream processing ? I'd like
to write the map content to the output. Is it possible ? 

Best regards, 

Christophe 

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.