Subject: [xsl] Selecting elements from source document based on matches to a second document From: "Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 6 Mar 2023 03:12:01 -0000 |
Greetings The requirement (preferably XSL 2) is to filter a log of source code edits by a list of paths held in a separate document. I can't believe there's not an elegant way of doing this in XSL but I haven't yet managed to find one. For example, given an input document which contains the log (empty elements below aren't empty, they are just to show the structure) <log> <logentry> <author/> <date/> <paths> <path>/here/a/document</path> <path>/there/another/document</path> .. </paths> <msg/> </logentry> <logentry/> <logentry/> .. </log> and a comparison document which contains a list of paths <checkpaths> <path>/there/another/document</path> <path>/over/the/hills/and/far/away</path> <path/> <path/> .. </checkpaths> I would like to produce an output document which consists of a log containing all the log entries where at least one of the logentry paths matches a path in the checkpaths document, and where the paths for each output logentry are limited to the matching paths. What would be the best way of achieving this? (And if there's a much cleaner method in XSL 3 I would be interested in seeing it, but our application is still using XSL 2 for the time being) To fill in the picture a bit, at the moment I am using the checkpaths list to generate a separate log document for each path, then combining and deduplicating the resultant logs, and doing it that way is the bottleneck in the workflow. So I hope that the approach outlined above may be significantly faster. And if it's not, well, I may still have learned a potentially useful technique. cheers T
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] having a template remembe, Chris Papademetrious | Thread | Re: [xsl] Selecting elements from s, Graydon graydon@xxxx |
Re: [xsl] having a template remembe, Dimitre Novatchev dn | Date | Re: [xsl] Selecting elements from s, Graydon graydon@xxxx |
Month |