Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 14th, 2008, 12:18 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
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?


Reply With Quote
  #2 (permalink)  
Old October 14th, 2008, 03:59 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.