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

How can I translate a single letter into a letter insi

Subject: How can I translate a single letter into a letter inside an element?
From: Chris Loschen <loschen@xxxxxxxxxxxxx>
Date: Thu, 13 Feb 2003 13:33:12 -0500
how can i translate
Hi, all!

Many thanks for all the help you have given me -- this list is a wonderful
resource. Here's my newest puzzle.

My original data uses an <sc> tag to indicate small caps data. Unfortunately,
it seems to assume that a true small caps font will be used to render that data,
because the data in this element is of mixed case. So, for instance, here are
two examples:


Peter Lewis <sc>DPhil</sc>

<sc>figure 1</sc>

As you can see, "figure 1" is clearly supposed to be in small caps (as it would
be using a true small caps font), and "DPhil" should have the "DP" in full-size
caps and the "hil" in small caps (again as it would be using a true small caps
font).

Unfortunately, we cannot use a true small caps font for my output format which is
a form of XHTML (actually OEB). I have a couple of bad options: (a) just reducing
the size but leaving the case alone, which would result in small lowercase letters;
(b) translating all the lowercase letters to caps and reducing the size, which takes
care of the small caps except where they are truly supposed to be full-sized caps,
so that "DPhil" would be a smaller version of "DPHIL".


A more elegant solution would require inserting a full-size span around capital letters
in a smallcaps span and translating the lowercase letters into uppercase so that
"DPhil" would be rendered


<span class="smallcap"><span class="full">DP</span>HIL</span>.

though this would be a workable alternative

<span class="smallcap"><span class="full">D</span><span class="full">P</span>HIL</span>.

That seems like it ought to be doable, but I'd need to replace individual characters
with a string of characters. I've just checked out Jeni Tennison's template for "multiple
string replacements" at http://www.dpawson.co.uk/xsl/sect2/StringReplace.html
and it looks promising -- is that the way I should go? Or is there some simpler
solution? I guess I'm hoping for something like the translate() function, but which lets
me replace the individual character with the character inside the span element.


Thanks in advance!


--Chris


----------------------------------------------------------------------------------------
Texterity ~ XML and PDF ePublishing Services
----------------------------------------------------------------------------------------
Chris Loschen, XML Developer
Texterity, Inc.
144 Turnpike Road
Southborough, MA 01772 USA
tel: +1.508.804.3033
fax: +1.508.804.3110
email: loschen@xxxxxxxxxxxxx
http://www.texterity.com/



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.