RE: [xsl] [XSL] How can I seek info in XML files and tranform it using XSLT to answer a query

Subject: RE: [xsl] [XSL] How can I seek info in XML files and tranform it using XSLT to answer a query
From: "Paul Brown" <prb@xxxxxxxxxxxxx>
Date: Wed, 11 Jul 2001 08:36:56 -0500
edouard panie:
> Thanks for answering. I should give some more details:
> -money is not the issue, I dont have any (it's a
> school project!)

Since you're a student, you're a very rich man indeed -- you have lots of

> -the pages will only be accessible to a few people,
> therefore there won't be more than a few hits a day.

If you don't want the implementation necessarily to be fast, you can spoof
an XSLT processor into thinking that your collection of files is one large
document, and that will allow you to use XPath as your query language.

Disclaimer 1: an XML database is going to do a MUCH, MUCH better job than
the hack below.

Here's how you do it.

1) Take a look at the old SQL extensions for XalanJ2 or the XSLT-based
flatfile mapper that I wrote as an example for a Java/XSLT class.

2) Implement a spoof DOM that mirrors the concatenation of your
directory/file structure and your individual XML files.  For example, this
means that the implementation of Node that represents a directory has to
return a list of the files it contains (as wrapping Nodes) when
getChildNodes() is called.

I would suggest implementing an equivalent<directory name="foo"><file
name="bar.xml" >[... ...]</file><file name="baz.xml" >[...

Where the children of file are the children of the document element of the
XML document contained in the file.

3) Do something really, really naughty and make use of how Xalan actually
traverses XML documents on an xsl:apply-templates call.  (You will NOT be
able to use xsl:for-each!)  This is present in the examples that I mention
in (1) above.


- Paul

 XSL-List info and archive:

Current Thread