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

Re: Making a lookup structure from multiple documents

Subject: Re: Making a lookup structure from multiple documents
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Jun 2023 18:49:16 -0000
Re:  Making a lookup structure from multiple documents
On 6/12/2023 8:33 PM, rick@xxxxxxxxxxxxxx wrote:
>
> I am missing something fundamental here I think. My accumulator is
> collecting the values from each topic separately, but I want it to
> accumulate the values from the entire hierarchy before I use them.
> Here is my output:
>
Accumulator, like keys, work on a per document basis. That is why in my
example I had some code doing e.g.


 B  <xsl:accumulator name="lookup" as="map(*)" initial-value="map{}">

 B B  <xsl:accumulator-rule
match="*[@href[matches(.,'(dita(map)?|xml)$','i')=true()][doc-available(.)]]"
>

 B B B  <xsl:variable name="collected" as="map(*)*">

 B B B B B  <xsl:apply-templates select="doc(@href)/*"/>

 B B B  </xsl:variable>

 B B B  <xsl:sequence select="map:merge(($value, $collected))"/>

 B B  </xsl:accumulator-rule>

</xsl:accumulator>

inside of the accumulator's rule body for the elements in the main
document and later made sure that for those nodes you want to lookup
there is a template outputting a value (which is then stored in the
accumulator of the original document, due to the above setup).

I will need to see whether you can combine an accumulator of the
original document with another on referenced documents; I think it is
easy with xsl:iterate or fold-left if you process a collection or uri
collection but if the processing is done lower in a template I don't
have a better suggestion currently than the above one.

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.