Re: [xsl] Apostrophe escaping in contains().

Subject: Re: [xsl] Apostrophe escaping in contains().
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 02 Dec 2003 14:15:20 -0500

You're escaping the apostrophe correctly, but once the parser is done with it, it is passing the expression

contains($text, '"'"')

to be interpreted as XPath. That's where you're hitting the error.

The usual workaround (FAQ alert) is to bind the character to a variable and use a variable reference.

...and in your other thread, why are you using disable-output-escaping?


At 12:08 PM 12/2/2003, you wrote:
I'm trying to get a test using contains() to look for an apostrophe. My XSLT processor (Saxon) keeps telling me that I need whitespace between attributes.

The fragment I'm working with looks like this:

<xsl:when test="contains($text, '"&apos;"')> some stuff </xsl:when>

I've searched the FAQs, and they report that I'm escaping the apostrophe correctly.

Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

XSL-List info and archive:

Current Thread