Re: [xsl] recognize character entities

Subject: Re: [xsl] recognize character entities
From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
Date: Thu, 31 Aug 2006 17:21:40 +0100
On 8/31/06, David Carlisle <davidc@xxxxxxxxx> wrote:

> match="*[matches(., '^[&#592;-&#65533;]')]"> > > does it and selects all elements starting with a 'special character'! > thanks frank

that only selects ones up to 65533, and a lot of math characters are
higher than that: there's a whole block starting at 119808 (hex 1d400) to
120831 (hex 1d7ff)  script A, &Ascr; for example is character 119964.

You might be better writing this as

*[not(matches(., '^[&#31;-&#591;]'))]

In which case


*[string-to-codepoints(.)[1] > 591]

would be nicer, wouldn't it?  It might be more efficient to substring
out the first character, rather that select the first from the
resulting sequence...

If you really want to use the range 31 to 591 you could do this:

<xsl:variable name="range" select="31 to 591" as="xs:integer+"/>

and then

*[string-to-codepoints(.)[1] != $range]

cheers
andrew

Current Thread