[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] On-the-fly case-conversion w. translate()


Subject: Re: [xsl] On-the-fly case-conversion w. translate()
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 6 Apr 2005 22:19:49 +0100

  <xsl:if  test= "@name [not (self::node() =
  following::Program/@name)]">

self::node() can be written more simply as .

  translate
  (following::Program/@name, abcdefghijklmnopqrstuvwxyz,
  ABCDEFGHIJKLMNOPQRSTUVWXYZ))]"

This has come up already today (and is a faq) lthough I'm not sure what
you'd search for. If you use a node set as an argument to a string
function xslt1 takes the first node in document order in the set and
uses that nodes string value, it ignores any other nodes.

it (might be) a bit more efficient or at least clearer  to use
following-sibling on the element node rather than following from the
attribute node,

test="@name=following-sibling::Program/@name"
tests if this nodes name attribute is equal to any of the following
nodes names.

test="translate(@name,$u,$l)=translate(following-sibling::Program/@name,$u.$l)"
tests if this nodes name attribute is equal to the _immediately
following_ Program nodes name attribute.

In this case you can do

test="following-sibling::Program/@name[translate(.,$u.$l) =translate(current()/@name,$u,$l)]"

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread