Subject: Re: [xsl] Need an XPath expression which returns all xs:pattern elements containing a regex that permits an unbounded number of characters From: "Piez, Wendell A. (Fed) wendell.piez@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 4 Apr 2024 14:06:54 -0000 |
Hello XSL-List, Indeed (as Willem says). It's too bad we can't parse the regular expression with a parser. But wait! The real solution and the only truly 'easy' one (unless you like bleeding edges) is Invisible XML or something like it. https://invisiblexml.org/ find or make the iXML grammar and you're mostly there. https://johnlumley.github.io/jwiXML.xhtml https://github.com/usnistgov/ixml-breadboard includes XSLT integrations (experiments that needed a home, though no regex grammar - yet). Cheers, Wendell From: Willem Van Lishout willemvanlishout@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, April 4, 2024 9:49 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Need an XPath expression which returns all xs:pattern elements containing a regex that permits an unbounded number of characters Is this even possible, theoretically speaking? As soon as you start using lookaheads, square brackets, and so on, your patterns will likely fail. I don't think regex can parse regex. On 4 Apr 2024, at 20:15, "David Carlisle d.p.carlisle@xxxxxxxxx<mailto:d.p.carlisle@xxxxxxxxx>" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx rytech.com>> wrote: On Thu, 4 Apr 2024 at 13:29, Roger L Costello costello@xxxxxxxxx<mailto:costello@xxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx rytech.com>> 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. XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list> EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3166594> (by email) XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list> EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3302254> (by email<>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Need an XPath expression , Willem Van Lishout w | Thread | Re: [xsl] Need an XPath expression , David Carlisle d.p.c |
Re: Re: [xsl] Need an XPath express, Edward Porter edward | Date | Re: [xsl] Need an XPath expression , David Carlisle d.p.c |
Month |