xsl-list
[Top] [All Lists]

Re: Search XML using XSL

2003-06-07 08:50:59
thei wrote:
It's just occurred to me that I should be able to use XSL to search an
XML file, so I played around with things like contains(), but then
realised I can't search more than one XML file or with more than one
search term so I thought I'd ask here.

I'd like to be able to search a set of XML files for "word1 word2" and
have all elements that contain both "word1" and "word2" in any order
returned. Or even just in that exact order. I can't work out how to
search more than one XML file at a time.

Investigate the use of document('foo.xml') to get the root node of an
arbitrary XML document, when given the document's URI. You can put the URIs in
elements in a separate document and iterate over them with for-each. Note that
every document you access via document() will be loaded into memory and most
likely kept there for the duration of processing, so XSLT is not ideal for
this job if you have many or large XML docs. You should look into writing a
SAX application. It'll be much faster and more efficient, but you will have to
get your hands dirty with lower-level programming.


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



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