[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
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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|