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 9th, 2015, 11:45 AM
bwb bwb is offline
Registered User
 
Join Date: Sep 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax error in replace regular expression argument

Using Saxon 9.6, the following value in the select attribute of an <xsl:value-of instance

replace(., '(\\|\/)$' ,'')

gives a syntax error (stylesheet version attribute is 3.0).

The error message is as follows:
"FORX0002: Syntax error at character 6 in regular expression. Escape character not allowed"

The pattern seems to pass muster in a regex tester. Might someone be able to explain this error in the XSL processing context?

Thanks
 
Old September 9th, 2015, 11:49 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Many regular expression dialects allow "/" to be escaped with a backslash, but the XPath dialect does not. Just remove the backslash. XPath prefers to reserve unused escape sequences for future use, to avoid compatibility problems later, whereas many dialects just ignore the backslash if the thing that follows is not a meta-character.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old September 9th, 2015, 01:12 PM
bwb bwb is offline
Registered User
 
Join Date: Sep 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default thank you

thank you for your quick and helpful response.





Similar Threads
Thread Thread Starter Forum Replies Last Post
The regular expression in replace() must not be one that matches a zero-length string ITEpicurean XSLT 1 November 22nd, 2009 06:18 AM
Regular Expression Error geek.shrek Perl 1 September 6th, 2009 01:05 PM
regular expression in replace() 3zor XSLT 2 May 20th, 2009 04:22 AM
Unknown Modifier Error - Regular Expression Beebs BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 March 20th, 2007 05:48 PM
Regular Expression Error kwilliams ASP.NET 1.0 and 1.1 Basics 3 February 16th, 2006 04:49 PM





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