xsl-list
[Top] [All Lists]

Re: [xsl] function for getting filename

2006-09-01 04:02:00
"andrew" == andrew welch 
<andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> writes:

    andrew> On 9/1/06, Frank Marent <frank(_dot_)marent(_at_)emnemics(_dot_)ch> 
wrote:
    >> i'm struggling again and again over this point:
    >> 
    >> is there a function in xslt that gives me the clean filename of
    >> the processed xml file? like
    >> 
    >> 'myfile.xml' 'test.xml' 'anyfilename.xml'
    >> 
    >> i do *not* need the document-uri. only the filename of the
    >> current processed xml file.

    andrew> In xslt 2.0 I use:

    andrew> tokenize(base-uri(.), '/')[last()]

That's not sound - . might not be the document node - if it's an
element with an xml:base attribute in scope, then you may get
something very spurious indeed.

Using document-uri in your expression looks sounder. 

If the OP is invoking a transformation from the command line, then he
can pass in the file name as a parameter. That is reliable.

-- 
Colin Adams
Preston Lancashire

--~------------------------------------------------------------------
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>
--~--