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 January 21st, 2010, 08:35 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default Tokenize and REGex Question

Hi,

I have the following value for @id:
Code:
ctl00_ContentPlaceHolder1_PICList_gridPICList__1_1_2_3row
I want to tokenize by any letter [a-zA-Z] and underscore. In XML Spy, this regex works fine, but in Saxon 9-1-0-7 i get an error:

Code:
<xsl:value-of select="tokenize(@id, '([a-zA-Z])|[\_]')[47]"/>
Error:

Code:
Error at xsl:value-of on line 17 column 69 of 8900-2.xslt:
  FORX0002: Error at character 13 in regular expression "([a-zA-Z])|[\_]": invalid escape sequence
Any thoughts?

thx
 
Old January 21st, 2010, 08:39 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I don't think the '_' needs to be escaped, simply try it without the backwards slash in front of it.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
bonekrusher (January 21st, 2010)
 
Old January 21st, 2010, 08:54 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Thanks Martin...
 
Old January 21st, 2010, 07:08 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Some regex dialects allow you to escape characters such as underscore even though they aren't metacharacters - the XPath dialect doesn't

Some products allow you to use regexs that are illegal according to the XPath specification - Saxon doesn't.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
bonekrusher (January 22nd, 2010)
 
Old January 22nd, 2010, 07:10 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Thanks Michael.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Tokenize JohnBampton XSLT 7 August 25th, 2009 07:34 AM
RegEx Example question williamjwayne BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 7 February 18th, 2009 09:57 PM
tokenize bbvic XSLT 1 July 19th, 2007 04:10 PM
Regex question in Java rangalo Java Basics 2 October 26th, 2006 09:26 AM
RegEx Question - Disregard dparsons ASP.NET 1.0 and 1.1 Professional 0 August 24th, 2006 09:30 AM





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