[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 19:47:01 -0000
Re:  Collect data from a whole map hierarchy
On 6/15/2023 9:26 PM, rick@xxxxxxxxxxxxxx wrote:
>
> 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.
>

I think, as you need to materialize each document to process it for
references, I would write a function to collect all referenced documents
i.e. replace the code

 B B B  <xsl:variable name="topic-uri-collection1"
select="//*/@href[matches(.,'(dita(map)?|xml)$','i')]/resolve-uri(.
,base-uri(.))[doc-available(.)]"/>

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

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

from my previous suggestions with something along the lines of (assuming
of course you would declare namespace for the prefix "mf"B  somewhere)


<xsl:function name="mf:collect-docs" as="document-node()*">

 B  <xsl:param name="input-doc" as="document-node()"/>

 B  <xsl:variable name="topic-uri-collection"
select="$doc//*/@href[matches(.,'(dita(map)?|xml)$','i')]/resolve-uri(.
,base-uri(.))[doc-available(.)]"/>

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

 B  <xsl:sequence select="$topic-docs, $topic-docs ! mf:collect-docs(.)"/>

</xsl:function>


and

 B B B  <xsl:variable name="referenced-topic-docs"
select="mf:collect-docs(.)"/>

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


I have no idea whether the DITA references could have cyclic references,
in that case that code above would cause an infinite recursion, I am
afraid. Therefore, be a bit careful before trying, I hope you know DITA
and your sample DITA documents better than I to judge whether the above
suffices and doesn't cause infinite recursion. If you know there can be
cycles of references, let us know, then we need some union to eliminate
duplicates and make sure the recursion only occurs on any newly found
references.

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.