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

Re: Collect data from a whole map hierarchy, then use

Subject: Re: Collect data from a whole map hierarchy, then use it in a topic
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Jun 2023 15:43:20 -0000
Re:  Collect data from a whole map hierarchy
On 6/15/2023 4:46 PM, rick@xxxxxxxxxxxxxx wrote:
> I am still trying to find the best way to navigate through an entire
> ditamap structure, collect certain data, then reprocess the map to
> insert the pertinent data into one of the topics. Earlier this week I
> posted code using an accumulator, but when I reprocess the map using a
> different mode, it only shows the each topicbs collected data.

Here is an attempt to avoid the various modes and the accumulator by
trying to simply select the various URIs and then their documents and
finally the elements you seemed to want to collect with XPath:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

 B B B B xmlns:xs="http://www.w3.org/2001/XMLSchema"

 B B B B xmlns:math="http://www.w3.org/2005/xpath-functions/math"

 B B B B xmlns:map="http://www.w3.org/2005/xpath-functions/map"

exclude-result-prefixes="xs math map"

version="3.0" expand-text="yes">

<xsl:variable name="topic-uri-collection1"

<xsl:variable name="topic-docs" select="$topic-uri-collection1 ! doc(.)"/>

<xsl:variable name="summary-data" select="$topic-docs ! (.//tool |
.//spare | .//supply)"/>

<xsl:output indent="yes"/>

<xsl:template match="/">


<xsl:for-each-group select="$summary-data" group-by="normalize-space(.)">

<xsl:sort select="local-name(.)"/>

<xsl:sort select="normalize-space(.)"/>

<xsl:element name="{local-name(.)}"><xsl:attribute name="quantity"





Perhaps that makes it easier for you to then use the global variable and
process the data with a mode. Note that the above with a simple XPath
selection will only work if you have that topic map referencing all
other documents, but not if referenced documents can as well reference
further documents; in the latter case you would need a recursive function.

Current Thread


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.
First Name
Last Name
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.