[Home] [By Thread] [By Date] [Recent Entries]

Subject: Re: Is XPath and/or XSLT designed such that I should never have to write special case code?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Jun 2021 04:27:33 -0000
On Tue, 2021-06-22 at 19:51 +0000, Dimitre Novatchev
dnovatchev@xxxxxxxxx wrote:
> 
> 
> Example: finding all (X)Html elements that have class $myClass:
> 
> B B B B B  //*[contains(concat(' ', @class, ' '), concat(' ', $myClass, '
> ')]
> 

Expressions like this, which work in some cases but are not partially
case insensitive in the way that HTML class attributes are defined to
be, is part of why we introduced contains-token() in XPath 3.B 

However, you're right, it's a good example for matching a token in a
space-separated list.

Liam

-- 
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member