Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for fn:matches #188

Closed
QAnders opened this issue Nov 21, 2019 · 9 comments
Closed

Request for fn:matches #188

QAnders opened this issue Nov 21, 2019 · 9 comments

Comments

@QAnders
Copy link

QAnders commented Nov 21, 2019

Hi, thanks som much for your hard work!
Any possibility to share a "roadmap" for fn:matches function?

Please see wvbe/node-schematron#1 (comment) for use-case... :)

@QAnders QAnders changed the title Request fro fn:matches Request for fn:matches Nov 21, 2019
@wvbe
Copy link
Contributor

wvbe commented Nov 21, 2019

I would like to add that fn:substring and fn:string-to-codepoints are other XPath functions currently not supported in fontoxpath, but used in the schematron file for which wvbe/node-schematron#1 was reported.

@JosVerburg
Copy link
Member

JosVerburg commented Nov 22, 2019

We indeed do not yet support fn:matches but fn:substring and fn:string-to-codepoints are implemented. @wvbe updating to the latest version should resolve those 2.

I'll take a closer look at matches to see if we can get that in sometime soon.

@DrRataplan
Copy link
Collaborator

The main historical problem with matches, and xs:patterns in general were the differences between JS regexes and xs:pattern. Recently though, https://github.com/bwrrp/xspattern.js was released.

Looking at the documentation of fn:matches, there is no replace yet, nor are there capture groups or backreferences (the point where XPath's xs:pattern deviates from the XSD xs:pattern), we should be able to implement it using that library.

I can not promise it will be implemented soon, but I'll take a look on how we can implement it! fn:matches has been on my wishlist for a while too!

@DrRataplan
Copy link
Collaborator

DrRataplan commented Dec 18, 2019

I took some time to work on this, and I found the following:

We'll track progress right here in this issue!

@DrRataplan
Copy link
Collaborator

DrRataplan commented Jan 7, 2020

I have made a PR on xspattern.js which implements basic pattern support for fn:matches, which has been integrated there. This covers everything that's needed for the schematron files referenced in the issue @QAnders made in @wvbe's schematron implementation. I believe those schematron rules only use 'simple' patterns: no backreferences, no flags, etcetera.

However, before integrating everything, I would at least like to be able to recognize everything that we do not yet support, and throw appropriate errors. For example, using backreferences in fn:matches should not act like the pattern contains a syntax error, but indicate that we do not support those yet.

@DrRataplan
Copy link
Collaborator

I made another PR on xspattern.js that covers the additional functionality: bwrrp/xspattern.js#13 If that one is done, expect a release here!

@DrRataplan
Copy link
Collaborator

DrRataplan commented Apr 9, 2020

A small update, I ran into various issues while getting the xspattern library injected properly. Mainly in the demo page. I'm expecting to work on that next week

@DrRataplan
Copy link
Collaborator

Good news! we managed to make it work! I'll publish this all this afternoon! Please get back to us if you have any feedback!

@DrRataplan
Copy link
Collaborator

FontoXPath 3.12.0 is a fact! Closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants