Re: [xsl] Use of Document Function to search in *.xml files

Subject: Re: [xsl] Use of Document Function to search in *.xml files
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 13 Nov 2002 11:28:12 -0500
Saurabh,

At 08:35 AM 11/13/2002, you wrote:
Can xsl:document funtion take (e:\base\*.xml)as input?

If you're asking whether the expression document('e:\base\*.xml') will work, the answer is no, since the string argument violates URI syntax.


If you're asking whether document('*.xml') works, it's still no, for the same reason. XSLT really doesn't want to specify a language for traversing a file system, so it uses URI syntax; URIs don't use wildcards.

However, the document() can take a node set argument, so you can do

document(file)

in a context where your source has children

<file>one.xml</file>
<file>two.xml</file>
<file>three.xml</file>

and get them all that way.

Of course, it may be convenient to put the file list somewhere other than your source document. In which case, naturally, you retrieve the node set with a document() function. As in:

<xsl:variable name="filenames" select="document('filelist.xml')//file"/>

and then call document($filenames), and voila.

I hope that helps,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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



Current Thread