Re: [xsl] XSLT collection function to get filenames

Subject: Re: [xsl] XSLT collection function to get filenames
From: "Arno H.P. Reuser" <a@xxxxxxxxxx>
Date: Sun, 16 Mar 2008 15:09:19 +0100
Exactly what I was looking for! Thanks!

Sincerely,

Arno H.P. Reuser
CEO, Reuser's Information Services

----
http://www.reuser.biz
a@xxxxxxxxxx



Martin Honnen wrote:
Arno H.P. Reuser wrote:

If the following:

    <x:for-each select="collection('?select=*.xml')">
        <br /><x:value-of select="//h1" />
    </x:for-each>

will print the value of 'h1' tags of each document with extension .xml in the current directory, then how can I get it to print/capture the filename itself of each file?

You can get the URI with <URL:http://www.w3.org/TR/xpath-functions/#func-document-uri>
<xsl:value-of select="document-uri(/)"/>
to get the file name you will need to take the string after the last slash.

Current Thread