xsl-list
[Top] [All Lists]

Re: [xsl] Get Document File name

2006-10-22 14:44:07
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(_dot_)vallone(_at_)verizon(_dot_)net>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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





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




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

<Prev in Thread] Current Thread [Next in Thread>