xsl-list
[Top] [All Lists]

Re: [xsl] function for getting filename

2006-09-01 05:11:37

So a further tokenization is necessary to remove query parameters and
fragment identifier.

this is true in general (as well as the observation that there may be no
file at all) but I've found editing base-uri like this to be very useful
in xslt2 stylesheets where it would be very hard to do the xslt1-thing
of passing in the filename as a parameter as the stylesheet is iterating
over a collection() so you don't really have any external control over
which input documents are being processed. Although I do know in those
cases that the uri will be file: without any # or / part.

I'd probably do replace(base-uri(/),'.*/','') to remove the path
component rather than tokenize and last() but it probably doesn't make
much difference really. You could add |[\?#].* to the regex to also
remove query and fragment identifiers if they were a possibility.


David



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