Subject: Re: xsl string comparison fails why?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 25 Sep 2002 18:20:41 +0100
|
Hi Tom,
> [ Yates, Danny]
>> For the first state (Alabama), "admissions/state/text()"
>> evaluates to something like:
>>
>> Alabama<cr><space><space><cr><space><space>
>>
>> Which is NOT the same as:
>>
>> Alabama
>>
>> You can solve this either by using normalize-space() or by
>> changing your <state> elements so that they don't use a mixed
>> content model (i.e. containing both text and other elements). e.g.:
>
> Actually, even nomalize-space() does not quite do it because it
> collapses all the whitespace down to one space, resulting in
>
> Alabama<space>
normalize-space() strips leading and trailing space, so if the string
was:
"Alabama<cr><space><space><cr><space><space>"
then all that trailing space would be stripped and you'd get:
"Alabama"
It's only spaces in the *middle* of the string that get collapsed down
to a single string. So for example:
"New<cr><space><space><cr><space><space>York"
would become:
"New York"
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- RE: xsl string comparison fails why?, (continued)
- Andrew Welch - Wed, 25 Sep 2002 12:15:28 -0400 (EDT)
- Passin, Tom - Wed, 25 Sep 2002 12:47:27 -0400 (EDT)
- David Carlisle - Wed, 25 Sep 2002 13:15:23 -0400 (EDT)
- Mike Brown - Wed, 25 Sep 2002 13:15:48 -0400 (EDT)
- Jeni Tennison - Wed, 25 Sep 2002 13:18:26 -0400 (EDT) <=
- Joerg Heinicke - Wed, 25 Sep 2002 13:21:36 -0400 (EDT)
- Wendell Piez - Wed, 25 Sep 2002 13:35:43 -0400 (EDT)
- Mike Brown - Wed, 25 Sep 2002 13:44:27 -0400 (EDT)
- Brinkman, Theodore - Wed, 25 Sep 2002 13:27:57 -0400 (EDT)
|
|