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

Re: Re: How can I translate a single letter into a let

Subject: Re: Re: How can I translate a single letter into a letter inside an element?
From: Chris Loschen <loschen@xxxxxxxxxxxxx>
Date: Tue, 18 Feb 2003 15:17:05 -0500
translate loschen
Hi, Dimitre!

Thank you very much for the pointer. I've downloaded the FXSL scripts for Xalan, which is what I'm using,
and I've tried to change the code in the example you cite so that it does what I'm hoping to accomplish.
However, I seem to be doing something wrong, because I'm getting a java "Out of Memory" error.


Here's the relevant portion of my spreadsheet:

...
<xsl:import href="/home/loschen/bin/xslt/fxsl/str-map.xsl" />
...
<xsl:variable name="vCaps" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
...
<myMark:myMark />
<xsl:template match="myMark:*">
<xsl:param name="arg1" />
<xsl:choose>
<xsl:when test="contains($vCaps, $arg1)">
<span class="fullsize"><xsl:value-of select="$arg1" /></span>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$arg1" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>


<xsl:template match="sc">
<xsl:variable name="vCapsSpanned">
<xsl:call-template name="str-map">
<xsl:with-param name="pFun" select="document('')/*/myMark:*[1]" />
<xsl:with-param name="pStr" select="./text()" />
</xsl:call-template>
</xsl:variable>
<span class="smallcap"><xsl:copy-of select="translate($vCapsSpanned,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" /></span>
</xsl:template>


The first few times I tried this, I got references to "idx:entry" which is an element (and namespace) which I'm not even
currently using -- it's an artifact from an earlier version of my code. I'm running the script on a file I've done before, so I
know there should have been no calls to idx:entry. I commented out the sections of the stylesheet that referred to that
and those errors went away, but I'm still getting a java.lang.OutOfMemoryError: null at an unknown location. Can you
(or anybody) see what I've done wrong? Thanks!



At 02:33 AM 2/14/03, you wrote:
> 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


The "str-map" template from FXSL does exactly this. For a recent example do have a look at:

"Re: find capital letters in string and split it"
http://article.gmane.org/gmane.text.xml.xsl.general.mulberrytech/7083





=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

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

--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.