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 June 17th, 2006, 05:21 PM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Escaping quotes from content

 I am using XSL to translate an XML document from a newswire into an SQL insert statment so that the feed can be loaded into a MySQL database.

I have the query actually building without issue, but the problem is that the quotes are messing up when the query fires.

My XSL file is as such:

<xsl:template match="IndexStoryHead">
INSERT INTO newsfeed VALUES (NULL,'<xsl:value-of select="(.)"/>',
</xsl:template>
<xsl:template match="Story">
'<xsl:value-of select="(.)"/>',0);
</xsl:template>

What is outputted is:
INSERT INTO newsfeed VALUES (NULL,'Eight charged in connection with Boxing Day shooting death of Toronto teen', ' TORONTO - Eight people are facing charges, including second-degree murder, in the shooting death of an innocent teenage girl in Toronto on Boxing Day. Toronto police Chief Bill Blair says three of the accused, including one youth, are charged with second-degree murder in the death of 15-year-old Jane Creba. ',0);

What I need to happen is for the single and double quotes get escaped out in the query. How would I go about doing this?

TIA,

Phil
 
Old June 18th, 2006, 08:15 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Search on Google for "replace text xslt". Here's one suggestion
http://www.xml.com/pub/a/2002/06/05/transforming.html
 and I think exslt has one as well. They all use a similar recursive technique to replace text.


--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
escaping < char tclotworthy XSLT 16 September 21st, 2007 04:31 PM
displaying single quotes and double quotes ren_123 Classic ASP Databases 2 February 22nd, 2006 02:17 PM
Escaping Ampersand Entities android66 Visual Basic 2005 Basics 2 February 5th, 2005 04:46 AM
Escaping < and > barnaclebarnes XSLT 4 October 5th, 2004 08:56 AM
Double Quotes and Single Quotes Problem phungleon Classic ASP Basics 7 May 27th, 2004 01:44 PM





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