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 July 7th, 2010, 08:36 AM
Authorized User
 
Join Date: Mar 2010
Posts: 45
Thanks: 6
Thanked 0 Times in 0 Posts
Default How to show single quotes

Hi,

i have requiremnet ..
where they want to show the url in single quotes like below
<nyomtatvanyok xmlns='http://www.apeh.hu/abev/nyomtatvanyok/2005/01'>

Though in my xsl i mentioned single quotes, in my out put it is showing double quotes
<nyomtatvanyok xmlns="http://www.apeh.hu/abev/nyomtatvanyok/2005/01">

may i know how to display the single quotes for url.iam using XLST verion 1

Thanks
Anil
 
Old July 7th, 2010, 08:44 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I am afraid the choice of the quote character is not something XSLT gives you control for. If you look at http://www.w3.org/TR/xslt#output for XSLT 1.0 or http://www.w3.org/TR/xslt20/#serialization the you will not find a way to control or specify the quote character.
If you use a .NET XSLT processor like XslCompiledTransform then you might be able to achieve what you want by using an XmlTextWriter for serialization as that has a property http://msdn.microsoft.com/en-us/libr...quotechar.aspx. But that is specific to a platform and of course it does not allow you to use a single quote for one attribute and double for another, all attributes would be delimited by the same quote character.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old July 7th, 2010, 09:43 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Generally XML parsers don't tell the application what kind of quotes were used around an attribute value in an input XML document; therefore XSLT takes the view that the receiving application won't care what kind of quotes were used, and it therefore provides no control over which kind are used in the serialized output.

(I sometimes use this as an example of the kind of feature that no-one would possibly want...)
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
tsmets (July 12th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying single quotes and double quotes ren_123 Classic ASP Databases 2 February 22nd, 2006 02:17 PM
Single Quotes in MySQL fields Dave Brown Beginning PHP 1 June 10th, 2005 06:49 AM
Problem with single quotes ' mnoon Access 7 March 16th, 2005 03:44 PM
Problem with " ' " (single quotes) Varg_88 Classic ASP Databases 2 September 3rd, 2004 08:50 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.