Subject: Re: [xsl] Apostrophe escaping in contains(). From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 2 Dec 2003 17:30:08 GMT |
> I've searched the FAQs, and they report that I'm escaping the apostrophe > correctly. No they don't: Your snippet is not well formed XML, so it will not have got as far as the XSLT engine: <xsl:when test="contains($text, '"'"')> some stuff </xsl:when> ^ ^ You can not have an " in an XML attribute that is delimuted by ", you have to quote the " Although actually your attribute isn't delimited at all it has a " at the start and nothing at the end so to make that well formed XML you'd have to have <xsl:when test="contains($text, '"'"')"> some stuff </xsl:when> But that means the XML parser would pass on the attribute value contains($text, '"'"') which is an Xpath error as you can't have a ' in a '-delimted XPath string. So working backwards, you want the Xpath contains($text, "'") which you then need to put into an XML attribute, either like this test="contains($text, "'")" or like this test='contains($text, "'")' remember that as far as the XML parser is concerned, Xpath syntax is nothing, you just follow the XML rules: either wrap it in " and quote any contained ", or wrap it in ' and quote any contained '. David -- http://www.dcarlisle.demon.co.uk/matthew ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Apostrophe escaping in co, Ben Trafford | Thread | Re: [xsl] Apostrophe escaping in co, Ben Trafford |
RE: [xsl] Apostrophe escaping in co, Allan Jones | Date | RE: [xsl] Apostrophe escaping in co, Ben Trafford |
Month |