xsl-list
[Top] [All Lists]

Re: [xsl] fixing XSL search using values from a variable against multiple XML files

2018-10-03 20:33:08
On Thu, Oct 04, 2018 at 01:16:05AM -0000, Dave Lang 
emaildavelang(_at_)gmail(_dot_)com scripsit:
    <xsl:variable name="filenames_from_directory_listing" as="xs:string"
select="unparsed-text('filenames_from_directory_listing.txt')"/>
    <xsl:variable name="filenames_to_find"
select="tokenize($filenames_from_directory_listing, '\s+')"/>

    <xsl:template match="/">

Stick this in a message:
<xsl:message><xsl:sequence select="count($filenames_to_find)"/></xsl:message>

to makes sure there's something in there, first thing in the template.
(Easiest way for this to fail is to not load the list.)

        <xsl:for-each select="collection('.?select=*.xml;recurse=yes')"/>
            <xsl:variable name="xml_filenames" select="."/>
                <xsl:for-each select="$filenames_to_find">
                    <xsl:if test="(contains($t, .))">
<xsl:message>{document-uri($xml_filenames)} contains {.}</xsl:message>
                    </xsl:if>
                </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

I'd recommend looking at the file:list() extension function.
(http://expath.org/spec/file#fn.list)

I'd also recommend sticking the file list in a variable, and adding
another message so you can tell if you found anything there.

Once you're sure you finding things, then work on the search logic.

-- Graydon
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>