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

RE: Quoting Quotes in a Stand Along Context

Subject: RE: Quoting Quotes in a Stand Along Context
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 25 Jan 2005 23:22:49 -0000
quoting quotes
XPath 1.0 doesn't define any way to escape quotes in a string literal.

XPath 2.0 allows you to escape the delimiting quotes by doubling them, for
example

"He said: ""I don't"""

You can achieve this escaping using the XPath 2.0 replace() function.

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: Alan [mailto:alan-xsl-list@xxxxxxxxx] 
> Sent: 25 January 2005 15:47
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Quoting Quotes in a Stand Along Context
> 
>     I'm writing a utility that matches nodes in a document. For
>     testing I'd like to simply print out a XPath statement that maps
>     to the node in the document. I'd like to compare that against
>     what I expect the output to be.
> 
>     I've got an XPath tracker in my SAX ContentHandler. It will
>     print something like this:
> 
>         /node()[1]/node()[4]/node()[2]
> 
>     Which ought to work, but it's hard to read.
> 
>     I'd rather emit something like this:
> 
>     /element[position() = 1
>              and local-name() = 'foo'
>              and namespace-uri = 'http://agtrz.com/foo-doc']/text()[3]
> 
>     Easier to specify.
> 
>     But with no context to set a placeholder, I don't know how to
>     escape single quotes in the unlikely event that one occurs in
>     the namespace URI.
> 
>     How do you escape single quotes in pure XPath?
> 
> --
> Alan Gutierrez - alan@xxxxxxxxx

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.