[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] testing which files have same element/@code
Subject: [xsl] testing which files have same element/@code From: James Cummings <James.Cummings@xxxxxxxxx> Date: Tue, 29 Jul 2003 15:42:31 +0100 (BST) |
Ok, I'm not sure the best way to attempt this. Let's say I have a file: --------filelist.xml <files> <file filename="file1.xml" name="File One"/> <file filename="file2.xml" name="File Two"/> <file filename="file3.xml" name="File Three"/> <file filename="file4.xml" name="File Four"/> </files> -------- Listing some files and a name. And then each of these files looks something like: --------file1.xml <foo> <bar code="123"> stuff </bar> <bar code="124"> stuff </bar> <bar code="126"> stuff </bar> <bar code="103"> stuff </bar> </foo> -------- Except that each file may have <bar> elements with different @code attributes. What I want to do is given a @code as an xsl:param or variable look through each file in filelist.xml to produce a list of those files which contain a @code that matches, outputting something like say an html form (assuming file3.xml doesn't contain a bar/@code='124') of something like: -------- <form action-"http://www.foo.com"> <select name="File-to-see"> <option value="file1.xml">File One</option> <option value="file2.xml">File Two</option> <option value="file4.xml">File Four</option> </select> <input type="hidden" name="code" value="124"/> <input type="submit" /> </form> -------- Better still, I'd like to be able to xsl:call-template this with a parameter in a number of stylesheets as it strikes me it could be useful if modular. So.. any suggestions on even where to start. I'd assume that I'd take filelist.xml as the input file, and xsl:for-each file/@filename use document to check if bar/@code exists, if it does then output the option. (No sorting needed as the order in filelist.xml is fine.) Is that the right way to go about it? I thought I'd ask first this time rather than beat my head against it for a day or two only to be told that there is a much better way. Thanks for any advice, James -- 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] dictating node processing, Andrew Welch | Thread | Re: [xsl] testing which files have , Rick Taylor |
Re: [xsl] xslt-processor in perl?, Thomas F. O'Connell | Date | RE: [xsl] testing which files have , Andrew Welch |
Month |