[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Converting a string to Uppercase or Lowercase without using translate() ?
Subject: Re: [xsl] Converting a string to Uppercase or Lowercase without using translate() ?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 27 Nov 2007 15:06:02 GMT
|
> 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.
Without looking at what any real system does I'd expect the variable to
be more efficient (in general) Although I doubt it's measurabl:-)
with an entity ref you first have to expand all the entities
and then the XSLT engine has to parse each instance as a new string
literal, whereas with a variable reference the string is internalised
just once as an xpath string and then accessed by reference (unless the
optimiser decides to inline the variable reference I suppose...)
> Would you tackle the following with a variable as well?
>
> <!DOCTYPE xsl:stylesheet [
> <!ENTITY nbsp ' '>
Personally I've never seen the facination with "nbsp" "#160" seems to be
just as good a spelling of that character name, so I'd just use  
> I don't think people new to XSLT should forget that we are, after
> all, working with XML files.
Although one problem with using entities like this is that some XML
parsers forget that a <!DOCTYPE reference doesn't imply a request to
validate so can generate lots of spurious warnings that the stylesheet
is invalid.
One use I have seen for entities in XSLT1 is as a proxy for function
definitions. Rather than having entities for xpath literals as in teh
examples here you can have an entity that expands to a boolean predicate
which you use as foo[&bar;] with teh predicate being evaluated each
time. Again though in xslt2 you can just parse the predicate once by
making it a function accessed like foo[my:bar(.)] which is often nicer
than using entity expansion.
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
Current Thread |
- Re: [xsl] Converting a string to Uppercase or Lowercase without using translate() ?, (continued)
- Colin Adams - Tue, 27 Nov 2007 08:32:29 +0000
- Andrew Welch - Tue, 27 Nov 2007 10:32:18 +0000
- Message not available
- G. Ken Holman - Tue, 27 Nov 2007 09:03:20 -0500
- Michael Kay - Tue, 27 Nov 2007 14:49:07 -0000
- David Carlisle - Tue, 27 Nov 2007 15:06:02 GMT <=
- Michael Kay - Tue, 27 Nov 2007 22:01:53 -0000
- Andrew Welch - Tue, 27 Nov 2007 15:14:07 +0000
- Message not available
- G. Ken Holman - Tue, 27 Nov 2007 10:37:48 -0500
- Andrew Welch - Tue, 27 Nov 2007 16:22:46 +0000
|