Subject: "Smart Quotes"
From: "Jelks Cabaniss" <jelks@xxxxxxxx>
Date: Fri, 26 Nov 1999 19:36:13 -0500
|
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 “ (HTML's "special" entity
“), the closing " with ” (”), and the single ' with ’
(’). The desired result should end up something like:
<p>She said, “Don’t you do that!”</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
|