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

Re: Converting a string to Uppercase or Lowercase with

Subject: Re: Converting a string to Uppercase or Lowercase without using translate() ?
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 27 Nov 2007 15:14:07 +0000
Re:  Converting a string to Uppercase or Lowercase with
On 27/11/2007, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
> I suppose ... I guess I see the problem as a lexical issue and not an
> algorithmic issue.  I cannot comment on optimization opportunities
> for XSLT engines when faced with an explicit string or a variable
> reference ... perhaps someone on the list can comment on this.
>
> Would you tackle the following with a variable as well?
>
> <!DOCTYPE xsl:stylesheet [
>     <!ENTITY nbsp '&#xa0;'>
> ]>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                   version="1.0">
>
>   . . . . . &nbsp; . . . . .


I use #160's... I guess I'm relatively young in the markup world (just
turned 29) so I've never really used entities much, especially to the
point where I'd prefer nbsp to it's actual value.

I really don't like doctype declarations at the top of my stylesheets,
but I don't like the use of entities in general.  I'm not too sure
why, but I think it might have come from hunting through ent files for
the definition using something like Notepad.  I've not had positive
experience with DTDs or entities (or default values) where I've
thought - "wow thats a good idea".  Perhaps I've not enountered them
enough in the wild, or the few that I have come across haven't been
done well.


> I don't think people new to XSLT should forget that we are, after
> all, working with XML files.

We are, but I think defining entities at the top of your stylesheet is
an abuse of the fact that XSLT is written in XML, rather than using it
in your favour.

You could for example, counter XSLTs verbosity with some entities:

<!ENTITY f-sib 'following-sibling'>

and

<xsl:value-of select="//a/&f-sib;::b"/>

to get all of the <b> following-siblings of <a>.

or perhaps "manage" your namespaces:

<!ENTITY xslt-ns 'http://www.w3.org/1999/XSL/Transform'>

<xsl:stylesheet xmlns="&xslt-ns;" version="2.0">

I know I'm being silly now...


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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.