[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Getting text from string
Subject: Re: [xsl] Getting text from string From: Mandar Jagtap <mandar.jagtap@xxxxxxxxxxx> Date: Tue, 1 Nov 2011 23:21:35 +0530 (IST) |
Try using tokenize() function. You can try something like this: <xsl:for-each select="tokenize($path, '/')"> <xsl:if test="position() = last()"> <xsl:value-of select="."/> </xsl:if> </xsl:for-each> This should return you "filename" as per your example string. Hope this helps! Mandar Jagtap >________________________________ >From: Stan Mikita <markev8@xxxxxxxxx> >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >Sent: Tuesday, 1 November 2011 10:48 PM >Subject: [xsl] Getting text from string > >Hi, > >I have a directory path value and i want to grab the text "filename" >to the right of the last "/". I've tried using the below without any >luck. Is there a reverse search where you can tell it to search from >the right up to the first occurence of a "/"? Value can be many >directories deep. > >path = "dir1/dir2/dir3/dir4/filename" > >xsl:variable name="dirPath" select="substring-before(@path,'/')"/ > >xsl:variable name="dirPath" select="substring-after(@path,'/')"/ > >--~------------------------------------------------------------------ >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@xxxxxxxxxxxxxxxxxxxxxx> >--~--
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Getting text from string, Michael Kay | Thread | Re: [xsl] Getting text from string, Mukul Gandhi |
Re: [xsl] Getting text from string, Michael Kay | Date | Re: [xsl] Getting text from string, Stefan Krause |
Month |