Re: [xsl] Tutorial for collection()

Subject: Re: [xsl] Tutorial for collection()
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 17 May 2007 18:29:08 +0100
> We can use patterns made with Regular Expressions. L

This implies that the search query takes a regex, but it doesn't as your
first example shows: *.* wouldn't be legal as a regex. 
Actually what it does take is a bit odd, it's designed to look like a
glob (comamnd line wildcard) for simple usage so  f*.xml matches all
.xml files staring with f, not all files whose names are a sequence of
f's followed by  any letter follwed by "xml", as it would be if it were
a regex.
As documented though it's really converted to a regexp by changing . to
\. and * to .* and adding ^ to the  front, so you can use some regex
syntax as well, which "falls through" this conversion, but you can't
write a regex that actually uses * with its regex meaning.



> The above stylesheet, collection.xsl, does not make use of an input
> file. You can use some dummy input file to start it up.  

as Colin said, better to stick a name="main"  attribute on the template and
start it with -it main

> In XSLT we can load documents with the xslt:document(), fn:doc(),
            xslt:unparsed-text() and  the fn:collection() functions. 

You are using the prefix there to denote which specdefines each
function, but I think that's confusing use, as they are all in the same
namespace.

> Only the last can use Regular Expressions and load many documents at a
> time.

document() can load many documents at one time, even in xslt 1.0. Even
Given a suitable URI resolver, it can load documents not known at
xslt-compile time, such as "all xml files in a directory".
And as noted above, as implemented in saxon collection URIs are not
really regular expressions.


David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread