qt4cg / qtspecs

QT4 specifications
https://qt4cg.org/
Other
27 stars 15 forks source link

Add fn:system-property() to XQuery #540

Open apb2006 opened 1 year ago

apb2006 commented 1 year ago

XSLT has specific additions to the XPath function library to facilitate identifying the running implementation:

These would be useful for XQuery too. There should be something better than the fragile sadness of https://github.com/AndrewSales/XQS/blob/461a90a8e2f49d9ef646ff6940c6962f18c0f43a/port.xqm#L3-L12

michaelhkay commented 1 year ago

It's unfortunate that the standard system-property names use the XSLT namespace...

I would suggest that rather than carrying the XSLT function over into XPath/XQuery as is, we do it with a new function fn:system-properties() that returns a map with entries such as host-language, version, product-name, product-version, etc.

ChristianGruen commented 12 months ago

The documentation of fn:system-property states that…

The set of system properties that are supported, in addition to those listed above, is also implementation-defined.

It seems obvious to Java processors to include the JDK System Properties, and the documentation of Saxon seems to consolidate this assumption. I’m not sure what’s the best way, but maybe we can make some more properties a fixed part of the new function…

file.encoding
file.separator
line.separator
native.encoding
os.arch
os.name
os.version
path.separator
user.dir
user.home
…others?
michaelhkay commented 7 months ago

Note that a particular difficulty with the current XSLT system-property() function is that it's not clear what it should do when the compile-time environment differs from the run-time environment, for example if different product versions or different operating systems are used in the two cases.

sashafirsov commented 7 months ago

This sounds very much like browser userAgent property. I personally agree that the execution environment parameters would be handy for many reasons from compatibility shims to analytics. The work around with feature detection is already used in large projects. But having it a part of the standard would make more sense to me as well.  Now what data it could/should contain? OS, Platform, OS version, processor( XPath/XSLT, XQuery, etc implementation) with version and variations( free/individual, corp lisense, etc). 

Why system properties are not suitable? The data are not formalized. I.e. need additional processing to get a parser version.