Re: [xsl] Making a lookup structure from multiple documents

Subject: Re: [xsl] Making a lookup structure from multiple documents
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Jun 2023 12:30:40 -0000
Hi Rick,

I try to store data in a way that aligns best with how I later need to access
it (flat, lookups, etc.).

If an XSLT3 map would work, you could create an "on-no-match='shallow-skip'"
template mode that crawls the map and returns a flat sequence of map entries.


  *   Chris


From: rick@xxxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, June 12, 2023 8:17 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Making a lookup structure from multiple documents

Hi All,

I have a ditamap that has references to child topics, and each child topic may
references to other topics. I need to collect the contents of three particular
elements, then then use them in a summary in one of the documents. Here is my
basic shell, where I am navigating through all of the referenced documents. I
also have a template for the items I am trying to collect (I can combine them
into a single template). I am looking for the best approach for making a
lookup of items that can be used later in the processing. Thank you.

Rick

<?xml version="1.0" encoding="UTF-8"?>
<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";
    exclude-result-prefixes="xs math"
    version="3.0" expand-text="yes">

    <xsl:output indent="yes"/>

    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="@href[matches(.,'(dita(map)?|xml)$','i')=true()]">
        <xsl:if test="doc-available(.)">
            <xsl:message>{.}</xsl:message>
            <xsl:variable name="refdoc" select="doc(.)"/>
            <xsl:apply-templates select="$refdoc/*"/>
        </xsl:if>
    </xsl:template>

    <xsl:template match="tools">
        <xsl:message>{local-name() || ' ' || base-uri(.) || ' ' ||
.}</xsl:message>
    </xsl:template>

    <xsl:template match="spares">
        <xsl:message>{local-name() || ' ' || base-uri(.) || ' ' ||
.}</xsl:message>
    </xsl:template>

    <xsl:template match="supplies">
        <xsl:message>{local-name() || ' ' || base-uri(.) || ' ' ||
.}</xsl:message>
    </xsl:template>

    <xsl:mode on-no-match="shallow-skip"/>

</xsl:stylesheet>
XSL-List info and
archive<https://urldefense.com/v3/__http:/www.mulberrytech.com/xsl/xsl-list__
;!!A4F2R9G_pg!aV9ogqoTVczCEepM7WsAghj2wK0IhbyUAPJZ3v_laaXFP3ME6x7HLJRI4VNLaq0
ttqzo9Qtp_rnjbIovlYFlAYBRl5zjKGGrd6TBxbgDIuYgeXksggJv$>
EasyUnsubscribe<https://urldefense.com/v3/__http:/lists.mulberrytech.com/unsu
b/xsl-list/3380743__;!!A4F2R9G_pg!aV9ogqoTVczCEepM7WsAghj2wK0IhbyUAPJZ3v_laaX
FP3ME6x7HLJRI4VNLaq0ttqzo9Qtp_rnjbIovlYFlAYBRl5zjKGGrd6TBxbgDIuYgeas0BQHN$>
(by email<>)

Current Thread