Re: [xsl] Need an XPath expression which returns all xs:pattern elements containing a regex that permits an unbounded number of characters

Subject: Re: [xsl] Need an XPath expression which returns all xs:pattern elements containing a regex that permits an unbounded number of characters
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Apr 2024 13:14:55 -0000
On Thu, 4 Apr 2024 at 13:29, Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> I want to find, in an XML Schema, all xs:pattern elements containing a
> regex that permits an unbounded number of characters.
>
> Here are examples of xs:pattern elements that I want to find:
>
> <xs:pattern value="A*"/>
> <xs:pattern value="A+"/>
> <xs:pattern value="A{0,.}"/>
> <xs:pattern value="A{1,.}"/>
>
>
> How to fix my XPath expression? Is the solution to add a second predicate:
>
> xs:pattern[
>         contains(@value, '*') or
>         contains(@value, '+') or
>         contains(@value, '{1,}') or
>         contains(@value, '{0,}')
>     ][
>         not(contains(@value, '\*')) and
>         not(contains(@value, '\+'))
>     ]
>
> Is that correct?
>
>
No.

A  pattern \\*   matches an unbounded list of backslashes  but fails your
test as it contains \*
A pattern X{5,}  matches an unbounded list  of X of at least 5 but doesn't
match your first predicate.

Current Thread