Closed Reino17 closed 5 years ago
The library is there, but the namespace is not defined.
You can enable it with --xmlns:jnlib="http://jsoniq.org/function-library"
(or any other prefix. only the url matters)
It is kind of deprecated with XPath/XQuery 3.1 coming
Ah, I see. I was looking at https://stackoverflow.com/q/54552141. Initially I had...
$ cat <<EOF | xidel -s - -e 'for $x in $json/conditional_ks return [$x() ! $x(.)()]'
{
"conditional_ks": {
"saturday": ["reportdata_by_type"],
"sunday": ["rt_report", "metadata"]
}
}
EOF
...return ["reportdata_by_type", "rt_report", "metadata"]
, but now I understand...
$ cat <<EOF | xidel -s - --xmlns:jnlib="http://jsoniq.org/function-library" -e '$json/[jnlib:values(conditional_ks)()]'
{
"conditional_ks": {
"saturday": ["reportdata_by_type"],
"sunday": ["rt_report", "metadata"]
}
}
EOF
...does the same.
I did a quick reading on XQuery 3.1. I understand it includes lots of json functions. Now I'm curious; how would this query look like when using XQuery 3.1?
?*
gives on level of values, so
cat <<EOF | xidel -s - -e 'array{$json?*?*?*}'
{
"conditional_ks": {
"saturday": ["reportdata_by_type"],
"sunday": ["rt_report", "metadata"]
}
}
EOF
Thank you.
http://www.benibela.de/documentation/internettools/xpath-functions.html#modulejnlib:
Did you include this library in the binaries you supply, Benito? No matter what function I try, I constantly get
Unknown namespace prefix: jnlib
.