Re: [xsl] Get Document File name

Subject: Re: [xsl] Get Document File name
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Sun, 22 Oct 2006 16:43:33 -0500
Hi, Phil,

The usual answer to this is to pass the filename as a parameter to the transform. Here's the FAQ entry: http://www.dpawson.co.uk/xsl/sect2/N3663.html

However, you could use some variety of string manipulation to get just the filename from the path.

The following transform does it:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>


<xsl:output method="xml" version="1.0"/>

<xsl:template match="/">
<filename><xsl:value-of select="tokenize(document-uri(.), '/')[last()]"/></filename>
</xsl:template>


</xsl:transform>

Jay Bryant
Bryant Communication Services

----- Original Message ----- From: "Philip Vallone" <philip.vallone@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Sunday, October 22, 2006 3:08 PM
Subject: [xsl] Get Document File name



Hi Everyone,

Is there a way to get the file name of the document you are processing? If I
use Document-uri() it returns the whole file path.


e.g.

'C:\temp\filename.xml'

I would like to get:

'filename.xml'

Is this possible?

Thanks,
Phil

Current Thread