[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: "rick@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Jun 2023 19:26:30 -0000
Re:  Collect data from a whole map hierarchy
Thank you Martin. I first want to get a list of all uribs throughout the
whole hierarchy, then I can integrate the rest of your code. I have a
recursive function to process the uribs but I am not sure how to get a
cumulative list. Thank you for your generous help.

<?xml version="1.0" encoding="UTF-8"?>

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




    exclude-result-prefixes="xs math rq"

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

    <xsl:output indent="yes"/>

    <xsl:variable name="map-uri-collection"


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

    <xsl:template match="/">

        <!-- Further processing here. -->


    <xsl:function name="rq:get-uri-collection">

        <xsl:param name="doc"/>

        <xsl:param name="uri-collection"/>

        <xsl:variable name="doc-uri-collection"

ri(. ,base-uri(.))[doc-available(.)]"/>

        <!--<xsl:variable name="uri" select="resolve-uri($uri,

        <xsl:if test="count($doc-uri-collection) &gt; 0">

            <xsl:for-each select="$doc-uri-collection">

                <xsl:message select="."></xsl:message>

                <xsl:variable name="doc" select="doc(.)"/>






From: Martin Honnen martin.honnen@xxxxxx
Sent: Thursday, June 15, 2023 11:44 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Collect data from a whole map hierarchy, then use it in a

On 6/15/2023 4:46 PM, rick@xxxxxxxxxxxxxx <mailto:rick@xxxxxxxxxxxxxx>

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>

    xmlns:xs= <http://www.w3.org/2001/XMLSchema>

    xmlns:math= <http://www.w3.org/2005/xpath-functions/math>

    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 !

    <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"

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

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

                    <xsl:element name="{local-name(.)}"><xsl:attribute
name="quantity" select="sum(current-group()/@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.

XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>

EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/612310>  (by
email <> )

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.