[
Lists Home |
Date Index |
Thread Index
]
Reading files from a directory might be possible using the
collection() function in XSLT 2.0 or XQuery, but it depends on the
implementation since the mapping of collection URIs to filestore isn't defined
in the spec.
With Saxon you can do something like
<xsl:for-each-group
select="collection('file://c:/some-directory?select=*.xml;recurse=yes')"
group-by="/doc/title">
<xsl:value-of
select="/doc/title"/>
<xsl:value-of
select="count(current-group())"/>
</xsl:for-each-group>
to give you a flavour of what's possible; for a more
specific solution one would need to know more about your
requirements.
As far as the choice between XSLT and XQuery is concerned,
I'm tending to sum it up like this:
(a) if your data is in a database, you need
XQuery
(b) copying a document with small changes is much easier in
XSLT
(c) extracting a small amount of information from your
documents is easier in XQuery
(d) XQuery is easier to learn and is simpler for small
jobs
(e) XQuery is better for highly-structured data, XSLT
for loosely-structured documents
(f) for large applications involving reusable components,
use XSLT
I'd encourage you to learn both, since 80% of what you
learn will be applicable to both languages.
Michael Kay
Hi,
Before going into
development of application, i have to make a portion using XML standards. So
the following situation is:
1. several XML
documents (all using the same DTD schema ) are uploaded onto
server.
2. using XSL
stylesheet, several information are being showed from all the XML
files.
3. combining
different information from different XML documents, new XML document is
produced.
for the 2. step
should I also use JAVA API for easier and faster processing of
information?
for step 3. i
don't know what is the best solution? again java? XQuery?
XSLT?
are there any
learn-samples to do this?
Thank you in
advance,
best
Tomaz
|