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 October 14th, 2008, 12:18 AM
Authorized User
 
Join Date: Jun 2008
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default preserving " for later use in testing in xslt

I have a db table that contains the validation xpath expression. When I read the table the XML is fine. It contains the escaped single and double quote test e.g. "not(contains(//node()[local-name()='firstname']/text(), "'")) and not(contains(//node()[local-name()='firstname']/text(), '"'))"

When I use xpath to retrieve the validation text (//column[@name='XPath_Validation']/text()) and store it in a variable so I can use it in WHEN clause, the xpath validation value no longer contains the escaped expressions but "'" or '"'. So my xslt fails.

I tried using CDATA to retransform the rows I read from the database, still no luck with it. I'm using xpath 1/xlst 1.

Is there a way to read the escaped ' and " still?


 
Old October 14th, 2008, 03:59 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>I have a db table that contains the validation xpath expression. When I read the table the XML is fine.

Sorry, you haven't explained that very well. You've got an XPath expression in a database table. So where does the XML come into it? Is it really an XPath expression in an XML document in a database table?

>When I use xpath to retrieve the validation text

I guess if you're using XPath to retrieve the string, then the string must be in an XML document. Which means you must have parsed the XML document. And converting " to " is one of the things that XML parsers do, for very good reasons.

>and store it in a variable so I can use it in WHEN clause, the xpath validation value no longer contains the escaped expressions but "'" or '"'.

Well, so it should. If you look in the XPath grammar, you won't find any mention of " or '. An XPath parser expects to see these written as " and '.

>So my xslt fails.

I don't think that's why it failed. How were you using the XPath expression contained in your variable? The only way to do this is using an extension such as dyn:evaluate(), and that certainly would not expect special characters to be escaped using XML conventions.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
replacing " gantait XSLT 1 March 4th, 2007 10:44 AM
J2EE & XSLT safin XSLT 1 September 9th, 2005 09:39 AM
Java & XSLT safin XSLT 0 September 8th, 2005 01:11 PM
Unit Testing XSLT N.Todd XSLT 2 March 1st, 2005 08:31 PM
Replace Character " fosca XSLT 1 November 11th, 2004 04:14 PM





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