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

Subject: Re: [xsl] fixing XSL search using values from a variable against multiple XML files
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Oct 2018 01:33:03 -0000
On Thu, Oct 04, 2018 at 01:16:05AM -0000, Dave Lang emaildavelang@xxxxxxxxx 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

Current Thread