Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XSLT Help and Discussion
»
Regex + XSLT 2.0
Topic
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next Topic
next
Subject:
Regex + XSLT 2.0
Author:
David Corley
Date:
11 Dec 2006 04:36 PM
Hey all,
I have a series of strings matching the following format:
"xxxxxxx\xxxxxxxx\xxxxxxxx\xxxxxxx\abcd.java"
I need to remove everything but "abcd".
Can anyone tell me how to do that within the constraints of the xslt-limited regex?
next
Subject:
Regex + XSLT 2.0
Author:
Ivan Pedruzzi
Date:
12 Dec 2006 11:18 AM
Originally Posted: 12 Dec 2006 11:19 AM
Hi David,
If the you are just looking for the file name you could do a reverse find on the separator and take the last token.
Hope this helps
Ivan Pedruzzi
Stylus Studio Team
<xsl:template name="findlasttoken">
<xsl:param name="string"/>
<xsl:param name="sep" select="'\'"/>
<xsl:variable name="next" select="substring-after($string, $sep)"/>
<xsl:choose>
<xsl:when test="$next">
<xsl:call-template name="findlasttoken">
<xsl:with-param name="string" select="$next"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
top
Subject:
Regex + XSLT 2.0
Author:
Ivan Pedruzzi
Date:
12 Dec 2006 11:21 AM
Forgot to remove the file extension
<xsl:template name="findlasttoken">
<xsl:param name="string"/>
<xsl:param name="sep" select="'\'"/>
<xsl:variable name="next" select="substring-after($string, $sep)"/>
<xsl:choose>
<xsl:when test="$next">
<xsl:call-template name="findlasttoken">
<xsl:with-param name="string" select="$next"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($string, '.')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next Topic
Powered by
Stylus Studio
, the world's leading
XML IDE
for
XML
,
XSLT
,
XQuery
,
XML Schema
,
DTD
,
XPath
,
WSDL
,
XHTML
,
SQL/XML
, and
XML Mapping
!
Go to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.