[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

"Smart Quotes"

Subject: "Smart Quotes"
From: "Jelks Cabaniss" <jelks@xxxxxxxx>
Date: Fri, 26 Nov 1999 19:36:13 -0500
smart quotes
Supposing you have as input

	<p>She said, "Don't you do that!"</p>

is there a way to convert the double and single quotes to "smart quotes"?  In
other words, substitute the opening " with &#8220; (HTML's "special" entity
&ldquo;), the closing " with &#8221; (&rdquo;), and the single ' with &#8217;
(&rsquo;).  The desired result should end up something like:

	<p>She said, &#8220;Don&#8217;t you do that!&#8221;</p>

Is there a way to do this using XSL, without pre-processing the XML document
first using some other tool?  It would be easy if the fragment read something
like

	<p>She said, <q>Don<rsquo/>t you do that!</q></p>

but if you don't have the luxury of such input, can it be done in XML+XSLT?

You would have to examine all #PCDATA with contains(), maybe use translate()(?)
for the single quotes (assuming here, of course, that you always want a *right*
single quote), but how would you handle the balanced double quotes?

Is this one of those things that needs to wait until XSLT has regular
expressions?

Thanks,


/Jelks


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.