Subject: RE: [xsl] Finding the path from the filename From: Cams Ismael <Ismael.Cams@xxxxxxxxxxxxxxx> Date: Mon, 20 Jan 2003 16:35:01 +0100 |
What you need is the position of the last \ character. So first write a template that returns you the position of the last \. Therefore you need something like this: <xsl:template name="lastCharPosition"> <xsl:param name="original"/> <xsl:param name="character"/> <xsl:variable name="char_len"> <xsl:value-of select="string-length($character)"/> </xsl:variable> <xsl:choose> <xsl:when test="contains($original,$character)"> <xsl:choose> <xsl:when test="contains(substring-after($original,$character),$character)"> <xsl:call-template name="lastCharPosition"> <xsl:with-param name="original" select="substring-after($original,$character)"/> <xsl:with-param name="character" select="$character"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="string-length(substring-before($original,$character))+$char_len"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:value-of select="string-length($original)"/> </xsl:otherwise> </xsl:choose> </xsl:template> If you have this position you can use the substring-before() function to return everything before the file name. Hope this helps. Kind regards, Ismaël -----Original Message----- From: Thomas V. Nielsen [mailto:thomas@xxxxxxxxxxxxx] Sent: maandag 20 januari 2003 16:18 To: XSL List Subject: [xsl] Finding the path from the filename In a XSLT I receive a parameter with a full path and file name, like; C:\Data\Test\File.xml I have tried fumbling with substring and substring-before, but with no luck. What I need is the full path without the file name, like C:\Data\Test\ Sometimes parameter looks like this ..\Test\File.xml And also here I need to find the path, like ..\Test\ Any suggestions in how to use the substring with some iteration? /Thomas XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Finding the path from the, Américo Albuquerque | Thread | Re: [xsl] Finding the path from th, Dimitre Novatchev |
RE: [xsl] RTF TABLE USING XSL, Krupant Vora | Date | RE: [xsl] Match Question, Américo Albuquerque |
Month |