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 September 5th, 2013, 09:20 AM
Registered User
 
Join Date: Jul 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Get specific character in text - xslt1.0

I have a below string

string = "C_123456789_1"

how to extract C_123456789 alone.

the character C and the number 123456789 may change...

Logically i want to extract the the characters left to the second underscore(_).

kindly help me
 
Old September 5th, 2013, 09:25 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

In pseudocode:

Code:
p1 = substring-before(in, '_')
p2 = substring-after(in, '_')
p3 = substring-before(p2, '_')
concat(p1, '_', p3)
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference

Last edited by mhkay; September 5th, 2013 at 09:25 AM.. Reason: markup
 
Old September 6th, 2013, 08:45 AM
Registered User
 
Join Date: Jul 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Youa re great!!

Youa re great!! thanks a lot .!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get a specific text from a string mrame XSLT 3 April 7th, 2009 07:03 AM
How to fetch text after specific tag text dipsut XSLT 10 May 23rd, 2007 02:57 PM
getnodes after specific text pendyalap XSLT 1 June 8th, 2006 05:13 PM
Focussing on a specific text box Dilip Nagle General .NET 4 January 6th, 2005 02:16 PM
Finding a specific character within a string tp194 Classic ASP Databases 2 October 12th, 2003 10:41 PM





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