xsl-list
[Top] [All Lists]

Re: [xsl] collecting a fileset with XSLT 2.0

2012-02-05 15:25:54
Thanks Ken! This does help, I'll check it out. That info is not in Michael Kay's XSLT 2.0 book. I'll blame him. Just kiddin.

Mark

On 2/5/2012 12:56 PM, G. Ken Holman wrote:
At 2012-02-05 12:51 -0800, Mark Giffin wrote:
Is there a way to collect a set of files off the file system in XSLT 2.0, in the same way that Ant lets you define a set of files with <fileset> like this:

<fileset dir="${src.dir}" id="all.docs">
<include name="**/*.xml"/>
<exclude name="**/gui/*.*"/>
<exclude name="tools/**/*.*"/>
<exclude name="content/extra/**/*.*"/>
</fileset>

Maybe an extension function or something? I've been using a manually-maintained list of files like this, but it's a a pain:

<docroot>
<root href="../../../doc_source/system100.xml" />
<root href="../../../doc_source/content/access/accesscore.xml" />
<root href="../../../doc_source/content/access/accesstest.xml" />
<root href="../../../doc_source/content/access/accesstest_commands.xml" />
  etc.
</docroot>

The concept in XSLT2 is the function collection(uri) which returns a set of root nodes of all the XML files addressed by the URI.

There is no standard for the URI string, so you have to read your vendor's documentation regarding how to compose the URI for what you want. For example, for Saxon, you would address all the XML files in the current and descendent subdirectories with something along the lines of:

    collection("./?select="*.xml;recurse=yes;on-error=ignore")

I hope this helps.

. . . . . . . . . . . Ken


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--