Solved

XSLT - String ending with a numeric

Posted on 2011-09-13
5
253 Views
Last Modified: 2012-06-21
How do i test if a String ends with a numeric ?
0
Comment
Question by:Molko
  • 4
5 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 36532206
given the string is $str

<xsl:if test="translate(substring($str, string-length($str)), '0123456789', '') = '' " >
...
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 36532214
substring takes the last character
the translate maps any digit to nothing
if the last character is a digit, this translate returns a ''
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 36532223
in XSLT2

<xsl:if test="matches($str, '\d$')" >
...
0
 

Author Comment

by:Molko
ID: 36532421
Hi

yeah, think i prefer the regex
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 36532645
me too, but for that you need an XSLT2 processor
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SP to delete duplicates 15 60
How to replace a token in a string with square brackets? 2 55
XSL FO - text wrapping and empty spaces 1 25
XML XSL Message 3 13
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now