[xsl] Re: testing which files have same element/@code

Subject: [xsl] Re: testing which files have same element/@code
From: James Cummings <James.Cummings@xxxxxxxxx>
Date: Wed, 30 Jul 2003 09:22:05 +0100 (BST)
>Date: Tue, 19 Aug 2003 10:17:30 -0600
>From: Rick Taylor <taylor@xxxxxxxx>
>Subject: Re: [xsl] testing which files have same element/@code
>This should work. However, it might be slow if you have lots of files to parse.
><xsl:param name="codeValue" select="'124'"/>
><xsl:template match="files">
>  <form action="http://www.foo.com";>
>   <select name="File-to-see">
>    <xsl:apply-templates
>select="file[count(document(@filename)/foo/bar[@code=$codeValue]) &gt; 0]"/>
>   </select>
>   <input type="hidden" name="code" value="{$codeValue}"/>
>   <input type="submit"/>
>  </form>
><xsl:template match="file">
>  <option name="{@name}">
>   <xsl:value-of select="@filename"/>
>  </option>

Yup, that was the kind of method I was assuming.  I've decided for the
pre-generated files this will be an ok way to do it - it doesn't matter
how long it takes (within reason) to create those.  For those that are
dymanically created in a cocoon pipeline, this seems less reasonable.

I suppose another way to do this would be to create an intermediate
file which contains all the possible @code values with a list of
what files have that code, so I could get the information by opening
only one file, which would be quicker.  So something like:
<bar code="123">
<file name="file1.xml"/>
<file name="file2.xml"/>
<file name="file3.xml"/>
<file name="file4.xml"/>
<bar code="134">
<file name="file1.xml"/>
<file name="file4.xml"/>
<bar code="139"/>

Dr James Cummings, James.Cummings@xxxxxxxxx, http://www.uea.ac.uk/~q503
Cursus Project, School of Music, University of East Anglia,
Norwich, Norfolk, NR4 7TJ, UK  Tel:(01603)593-595

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread