xsl-list
[Top] [All Lists]

Re: [xsl] Converting a string to Uppercase or Lowercase without using translate() ?

2007-11-27 03:32:53
On 26/11/2007, G. Ken Holman <gkholman(_at_)cranesoftwrights(_dot_)com> wrote:
If by "nicer" you'll accept "more compact", this is what I direct my
students to include at the top of their stylesheets:

<!DOCTYPE xsl:stylesheet [
   <!ENTITY lower 'abcdefghijklmnopqrstuvwxyz'>
   <!ENTITY upper 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'>
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 version="1.0">


Then, in your stylesheet you would have:

<xsl:variable name="pClubCaps"
               select="translate($pClub,'&lower;','&upper;')"/>

But as for functionality, translate() is all we have to work with in XSLT 1.0.

Hi Ken,

Out of interest - why in this case would you prefer using entities
over variables?  My advice would be to avoid entities, I don't see any
benefit here (or in most cases, so I'm approaching this from an
already negative angle :) ....  especially for people new to XSLT.

thanks
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>