[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Placing mark-up in between strings

Subject: Re: Placing mark-up in between strings
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 23 Nov 2006 15:01:31 GMT
Re:  Placing mark-up in between strings
> Are you sure these are the only characters to escape? 

They are all the ones that can be escaped with \
see
http://www.w3.org/TR/xmlschema-2/#dt-cces1

which includes - so I put it in although you don't need to escape it
really as it's only special in [a-z] and if you have already escaped [
and ] then - will never be taken to be a character range.

> And '$'?

which reminds me I didn't include the special characters added in xpath
regex, so yes you need to add $ (but that's the only one)

http://www.w3.org/TR/xpath-functions/#regex-syntax

so corrected function is

 <xsl:function name="f:escape">
   <xsl:param name="s" as="xs:string"/>
   <xsl:sequence select="replace($s,'[\\\|\.\-\^\?\*\+\(\)\{\}\[\]\$]','\\$0')"/>
 </xsl:function>

David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.