Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 23rd, 2011, 09:52 PM
Authorized User
 
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can I get N character from the right

I have to extract a substring in xslt 1.0 that is located at the end of a string so I basically need to get the substring from the right.

For example if I have 123456789123, I need to get 89123. Currently, I can use the function substring to get the string from the left. Any idea on how to accomplish this?
 
Old March 24th, 2011, 03:08 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You need to use Maths. If you want the left N, and your string is of length L then you start at L-N, and take the next N characters. Get the length using string-length() function and you're sorted.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?





Similar Threads
Thread Thread Starter Forum Replies Last Post
character entity into numeric character entity srkumar XSLT 1 November 22nd, 2007 04:53 AM
Replace character gregalb SQL Server 2000 6 July 12th, 2007 01:14 AM
Only the first character jroxit Classic ASP Basics 1 January 23rd, 2006 03:41 PM
Character set muthukumar Oracle 0 November 8th, 2005 12:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.