[basex-talk] Calling the sort function with two arguments

2017-03-22 Thread Martin Honnen
:93) at org.basex.gui.GUI.exec(GUI.java:471) at org.basex.gui.GUI.access$300(GUI.java:44) at org.basex.gui.GUI$6.run(GUI.java:413) A similar error occurs with sort((5, 3, 4, 1), ()) Is BaseX 8.6.2 not yet in line with the freshly published spec? Regards, Martin Honnen

Re: [basex-talk] BASEX: REST: PUT to change a XML file in DB

2017-07-10 Thread Martin Honnen
On 10.07.2017 15:16, Roland Krause wrote: Hi all, I installed basex for keeping and updating XML files. I can load a XML into a browser with javascript ... var xhr = new XMLHttpRequest(); xhr.open( "GET", "http://localhost:8984/rest/XMLfiles/cmuInput.xml;, true); xhr.send(); var xml =

[basex-talk] Should xml-to-json ignore a "key" attribute of a "map" root element?

2017-08-17 Thread Martin Honnen
When I try xml-to-json( http://www.w3.org/2005/xpath-functions; key="root"> 2 a true , map { 'indent' : true() } ) with BaseX 8.6.5 I get an error "[FOJS0006] Element 'map' must have no key.". Saxon 9.8 however parses that input fine. Looking at

Re: [basex-talk] bug in XPath evaluation

2017-08-20 Thread Martin Honnen
On 20.08.2017 15:29, nikos dimitrakas wrote: I discovered a strange behavior i BaseX (8.6.5): But when I evaluate //S/@k/parent::*[.//@m="V"] or //S/@k/..[.//@m="V"] it does not work. There is no error, just no result. When I run your path expression directly against your posted sample

Re: [basex-talk] restxq output cdata-section-elements

2017-06-01 Thread Martin Honnen
Am 01.06.2017 um 23:19 schrieb Maximilian Gärber: Hi, when setting %output:cdata-section-elements("KSP DESCRIPTION") on a restxq request, I get Zur Aktivierung des... außerordentlich hoher Biotingehalt (3 Millionen µg pro kg) gut

[basex-talk] Problem with serialize function and use-character-maps option

2017-06-18 Thread Martin Honnen
When I try serialize("This is a test with a slash / Test.", map { 'method' : 'json', 'use-character-maps' : map { '/' : '/'}}) with BaseX 8.6.4 is indicates an error [SEPM0017] Invalid 'use-character-maps' value 'map { "/": "/" }'; must be a string. However, the W3C spec

Re: [basex-talk] json-to-xml and xpath

2017-08-26 Thread Martin Honnen
On 26.08.2017 12:23, Günter Dunz-Wolff wrote: I’m trying to get data out of json via xquery. This is my scenario: 1. Fetching data with fetch:text() calling a REST-API 2. Transforming the data with json-to-xml, so I’ll get something like http://www.w3.org/2005/xpath-functions“>

Re: [basex-talk] XML import issue (header related)

2017-09-01 Thread Martin Honnen
On 01.09.2017 19:41, Ron Katriel wrote: Thanks Martin. Below is the modified query with the namespace specification and usage. It works but is cumbersome. Is there a way simpler way around this - other than modifying the input header to remove the namespace declaration? I don't think you

Re: [basex-talk] XML import issue (header related)

2017-09-01 Thread Martin Honnen
On 01.09.2017 22:01, Alexander Holupirek wrote: On 1. Sep 2017, at 19:41, Ron Katriel wrote: Is there a way simpler way around this - other than modifying the input header to remove the namespace declaration? declaring a default element in your XQuery might help?

Re: [basex-talk] XPath generator

2017-11-17 Thread Martin Honnen
On 17.11.2017 15:06, Giuseppe Celano wrote: I would like to ask what the best way is in BaseX to create XPath expressions once I identify a certain span in an XML file. More concretely, I usually tokenize a text contained in an XML document, and I would like to specify for each token its

Re: [basex-talk] losses von tags?

2017-11-01 Thread Martin Honnen
Am 01.11.2017 um 22:54 schrieb michael4...@arcor.de: Hello, There is a *problem in transforming data vom XML in HTML*. In XML there are HTML-tags included. XML original: *text is important.* HTML goal: *text is important.* (1) result: text is important. let $data := text is important.

Re: [basex-talk] XQuery 3.1/Build array of maps dynamically

2017-12-12 Thread Martin Honnen
On 12.12.2017 13:30, Hondros, Constantine (ELS-AMS) wrote: I was already kicking myself for rushing and not providing a SCE! Please see the code below, and thanks. declare option output:method 'json'; declare variable $authors :=         Robert A     Sanders           

Re: [basex-talk] XML well-formed error

2018-06-06 Thread Martin Honnen
I think the problem is that your XSLT generates a result fragment with several top level chapter elements, lacking a single root element containing the other elements. So you need to change the stylesheet to create a single root element or someone with more BaseX inside skills needs to tell how

Re: [basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Martin Honnen
On 28.08.2018 11:04, Marco Lettere wrote: here's a question related to XQuery, sorry for being slightly off-topic. I'm struggling to find a way to combine the windowing clause and FLOWR in order to get a paged result of a subset of items which respect a given filter. Of course I'm able to

Re: [basex-talk] XSLT Module: feature request - XSLT 3.0 support

2018-04-09 Thread Martin Honnen
On 09.04.2018 19:14, Yitzhak Khabinsky wrote: We have Saxon EE edition v.9.8.* licenses and are using XSLT stylesheets compliant with the  XSLT 3.0 standard. Unfortunately, BaseX XSLT module currently supports up to XSLT 2.0 standard only. return xslt:processor(), xslt:version() yields the

Re: [basex-talk] fn:format-number() for german style numbers

2018-10-27 Thread Martin Honnen
Am 27.10.2018 um 08:39 schrieb Wiemer, Sebastian: How do I format german style numbers e.g.: 1.000.00,99€ (for one million € and 99cents) ? The following approach: format-number(26825.8, '#.###,00') yielded an error: [FODF1310] Invalid picture string: '#.###,00'. See

[basex-talk] Should serialize function take "newline" : "\r\n" option in the map parameter into account?

2018-09-04 Thread Martin Honnen
When I run contains(serialize("Line 1.Line 2.Line 3.", map { "method" : "text", "newline" : "\r\n" }), '') in BaseX 9.0.2 (from the command line basex.bat or in the GUI) I get the result "false" while I expected "true". Have I not provided the newline option correctly?

Re: [basex-talk] Reg : Xquery performence

2018-11-28 Thread Martin Honnen
Am 28.11.2018 um 10:45 schrieb chandra Sekhar: Dear basex, Please find attachment for sample xml,Like sample xml we are added multiple xml's to the collection .Below query is my XQuery ,It is taking huge time,Can we optimize this query. My collection size is nearly 1.5 GB let

Re: [basex-talk] Two questions on use of the serialize function and character maps

2019-04-02 Thread Martin Honnen
Hi Christian, On 02.04.2019 14:36, Christian Grün wrote: 1) Is there any way to provide the "use-character-maps" parameter supplied the XPath 3.1 way with a second argument to "serialize" as a map: serialize("a,b", map { 'method' : 'text', 'use-character-maps' : map { "'" : "apos;" }})

Re: [basex-talk] Two questions on use of the serialize function and character maps

2019-04-02 Thread Martin Honnen
On 02.04.2019 22:37, Christian Grün wrote: What's your view of adaptive serialization of map(xs:string,xs:string) and a character map, should the character map be applied to the map's key and value string values? My general view on the adaptive serialization method is that I would have loved

Re: [basex-talk] BigInteger

2019-04-05 Thread Martin Honnen
Am 05.04.2019 um 11:15 schrieb Andre Bovy: Hi Chistian, I am trying to use a very Big Integer in BaseX (9.1.2) With this value : declare namespace BigInteger = "java:java.math.BigInteger"; BigInteger:new("12345678901234567890”) I received : Cannot convert xs:string to xs:integer:

Re: [basex-talk] Two questions on use of the serialize function and character maps

2019-04-05 Thread Martin Honnen
On 05.04.2019 17:50, Christian Grün wrote: Out of interest: What are your use cases for the adaptive serialization method? The question about the character map support arose in the context of trying to create an XPath 3.1 character map itself in XSLT and serialize it in a way that it could be

Re: [basex-talk] Higher order functions in XSLT

2019-03-28 Thread Martin Honnen
Am 28.03.2019 um 11:48 schrieb nikos dimitrakas: Hi! Is there something in BaseX that prohibits using higher order functions in XSLT (called with xslt:transform)? for-each($somenodes, function($q) { string($q) }) and for-each($somenodes, string#1) both work in XQuery in BaseX, but when I

[basex-talk] Two questions on use of the serialize function and character maps

2019-03-31 Thread Martin Honnen
I am struggling to use the "serialize" XPath 3.1 function as specified by the W3C with BaseX 9.1.2: 1) Is there any way to provide the "use-character-maps" parameter supplied the XPath 3.1 way with a second argument to "serialize" as a map: serialize("a,b", map { 'method' : 'text',

Re: [basex-talk] following-sibling axis

2019-02-26 Thread Martin Honnen
Am 26.02.2019 um 07:54 schrieb Mark Bordelon: But I have a question about some behavior I am seeing in the *following-sibling* axis that does not seem logical to me. Here is the data stored in basex: > xquery /text[@id='test']   Aa B Cc   Here is the query on that data: > *xquery

Re: [basex-talk] following-sibling axis

2019-02-25 Thread Martin Honnen
Am 26.02.2019 um 07:54 schrieb Mark Bordelon: Guten Tag, Love my basex, have been using it for years. I particularly love being able to have access to all the powerful 2.0 syntax. But I have a question about some behavior I am seeing in the *following-sibling* axis that does not seem logical

Re: [basex-talk] following-sibling axis

2019-02-26 Thread Martin Honnen
Am 26.02.2019 um 18:52 schrieb Mark Bordelon: A follow-up:  starting basex -w does NOT seem to solve completely my issue after all. Real data (more complicated than the simplified example) still does not query correctly: text nodes from after later elements are displayed in the place of null

Re: [basex-talk] Func def & performance: element()* vs item()*

2019-04-11 Thread Martin Honnen
Am 11.04.2019 um 00:09 schrieb Chuck Bearden: BaseX is a great tool for analyzing & characterizing large amounts of XML data. I have used it both at work and on personal projects. I hope the following observation is useful. When I define a function that recurs over a sequence of elements in

Re: [basex-talk] Serialize to XHTML 5?

2019-05-04 Thread Martin Honnen
Am 04.05.2019 um 12:41 schrieb Andreas Mixich: let $doc := Example TitleParagraph return serialize($doc, map{"method":"xhtml", "version":"5.0"}) Use   serialize($doc, map{"method":"xhtml", "html-version":"5.0"}) Note however that XHTML usually means the HTML elements are in the XHTML

Re: [basex-talk] Query filter by attributes with Colons

2019-07-15 Thread Martin Honnen
On 15.07.2019 16:34, Jordan Castillo wrote: I am noticing that my queries aren't working when I check the value of an attribute who has a colon in the name field. Here is an example: 1: Yields no results   let $begin := db:open($documentName)   return

Re: [basex-talk] xs:string("<")

2019-08-25 Thread Martin Honnen
Am 25.08.2019 um 14:16 schrieb Giuseppe G. A. Celano: I am wondering why xs:string("&") is not possible, but xs:string("<") is (although XML does not allow both ). Is there any reason? Thanks. You are allowed to use some predefined entity references and to use character references in

Re: [basex-talk] XQuery Update and Namespace Manipulation

2019-09-10 Thread Martin Honnen
On 10.09.2019 03:50, Andreas Mixich wrote: adding to my last email: of course, this way I still did not solve addition of more namespaces. Any ideas on that? modify insert node namespace {"foo"} {"foobar"} into $c/self::node() Because, even if I reconstruct the node completely, with the

Re: [basex-talk] XQuery Update and Namespace Manipulation

2019-09-09 Thread Martin Honnen
On 09.09.2019 20:30, Andreas Mixich wrote: Hi, copy $c := ipsum dolor sit amet modify insert node namespace {"lipsum"} {"lorem-ipsum"} into $c return $c Expected result: ipsum dolor sit amet The namespace is part of the name of a node so you need to rename the node(s) in a namespace if you

Re: [basex-talk] XQuery Update and Namespace Manipulation

2019-09-09 Thread Martin Honnen
On 09.09.2019 20:35, Martin Honnen wrote: On 09.09.2019 20:30, Andreas Mixich wrote: Hi, copy $c := ipsum dolor sit amet modify insert node namespace {"lipsum"} {"lorem-ipsum"} into $c return $c Expected result: ipsum dolor sit amet The namespace is part of the name o

Re: [basex-talk] comment()

2019-08-07 Thread Martin Honnen
On 07.08.2019 18:52, Marc wrote: I want to write a comment in the xml I produce with my XQuery. I try to use the comment() function, but each time I want to put something inside the () i have a syntax error. If you want to create a comment node computed by an expression use comment {

Re: [basex-talk] Coding help

2019-08-05 Thread Martin Honnen
Am 05.08.2019 um 08:41 schrieb Greg Kawchuk: Hi everyone, I'm wondering if someone could provide what I think is a brief script for a scientific project to do the following. The goal is to identify XML documents from a very large collection that would be too big to load into a database all at

Re: [basex-talk] Declaring namespaces in xquery:eval call

2019-08-09 Thread Martin Honnen
On 09.08.2019 20:50, Buddy Kresge wrote: I am trying to do something like xquery:eval(“some:function()”), and when I go to execute I get “[XPST0081] No namespace declared for ‘some:function’ Can't you just declare the proper namespace in a prolog of the code you pass to eval e.g.

Re: [basex-talk] comment()

2019-08-08 Thread Martin Honnen
Am 08.08.2019 um 08:46 schrieb Marc: I use very often the comment() with XSLT, and I confuse it with the "comment" literal of XQuery ! But even in XSLT the use of "comment()" is only for selecting/matching comment nodes (or for declaring a type), not for creating/constructing them. In XSLT

Re: [basex-talk] Quickest way to parse a DomSource

2019-07-22 Thread Martin Honnen
Am 22.07.2019 um 11:32 schrieb Marco Lettere: I have to access portions of the XML representation of the BPMN file by binding the engine's API. The closest that I can get to a standard XML representation is currently a javax.xml.transform.dom.DOMSource. What is the shortest way to transform

[basex-talk] Does BaseX used as a command line XQuery processor build a full tree of an input document passed with -i option?

2019-10-02 Thread Martin Honnen
If I use BaseX (9.2.4) simply as an XQuery 3.1 processor from the command line with e.g. basex.bat -i input.xml query.xq does BaseX then first always parse the input.xml into an XDM tree, meaning if I use huge input documents that way I can run easily run out of memory? Or does that depend

Re: [basex-talk] Weird: mixed content trimmed unexpectedly

2019-12-09 Thread Martin Honnen
On 09.12.2019 16:51, Omar Siam wrote: Probably there is an option (CHOP?) that one can set to tell BaseX not to trim whitespace at the edges of text nodes. Yes, see http://docs.basex.org/wiki/Options#XML_Parsing

Re: [basex-talk] Issue with years-from-duration!?

2019-12-06 Thread Martin Honnen
Am 06.12.2019 um 11:23 schrieb France Baril: The following function returns P4511D: 0 but I expect P4511D: 12 Bug or bad usage? let $d1 := xs:date('2007-07-31') let $d2 := xs:date('2019-12-06') let $duration := $d2 - $d1 let $years := years-from-duration($duration) return

Re: [basex-talk] Issue with years-from-duration!?

2019-12-06 Thread Martin Honnen
Am 06.12.2019 um 11:32 schrieb Martin Honnen: Am 06.12.2019 um 11:23 schrieb France Baril: The following function returns P4511D: 0 but I expect P4511D: 12 Bug or bad usage? let $d1 := xs:date('2007-07-31') let $d2 := xs:date('2019-12-06') let $duration := $d2 - $d1 let

Re: [basex-talk] simplest possible FLOWR specifying a database

2019-10-12 Thread Martin Honnen
Am 12.10.2019 um 10:11 schrieb thufir: nevermind, it's: let $db := db:open("com.w3schools.books") return $db/bookstore I thought it was unusual because of db:open. You would not even need the "let .. return", if you simply want a short expression you can also use  

Re: [basex-talk] Dynamic evaluation?

2020-02-26 Thread Martin Honnen
Am 26.02.2020 um 12:42 schrieb Ben Engbers: Hi, I want to declare a function that can operate on various elements of a record. It should be possible to pass the element-name as parameter to the function. I tried this: declare function local:cloudWords( $Veld as xs:string ) as xs:string* {

Re: [basex-talk] Deactivate JSON escape

2020-02-26 Thread Martin Honnen
Am 27.02.2020 um 08:29 schrieb Johannes Bauer: Am 27.02.2020 um 08:25 schrieb Johannes Bauer: Am 27.02.2020 um 08:15 schrieb Martin Honnen: Am 27.02.2020 um 07:49 schrieb Johannes Bauer: I'm trying to deactivate the escaping of characters for JSON serialization. It does not work

Re: [basex-talk] Deactivate JSON escape

2020-02-26 Thread Martin Honnen
Am 27.02.2020 um 07:49 schrieb Johannes Bauer: I'm trying to deactivate the escaping of characters for JSON serialization. It does not work with this: let $json := http://www.w3.org/2005/xpath-functions;>     http://some.url/path/to/somewhere return json:serialize($json, map {'format' :

Re: [basex-talk] filtering NaN from a sequence

2020-02-02 Thread Martin Honnen
Am 03.02.2020 um 01:22 schrieb Graydon Saunders: for $value in $xmlReport/csv/record/Payment_Amount/number()   where ???   return $value Can you live with for $value in $xmlReport/csv/record/Payment_Amount   where $value castable as xs:double   return xs:double($value) ?

Re: [basex-talk] how to nest tags using a conditional

2020-02-19 Thread Martin Honnen
Am 19.02.2020 um 15:08 schrieb thufir: How can I start a new "record" and then nest tags in that record? but I'm getting output like:     if (matches($line, "[0-9]"))   then people   else people       if (matches($line, "[0-9]"))   then joe   else joe   .. wheras

Re: [basex-talk] how to store a result in a database?

2020-02-19 Thread Martin Honnen
Am 19.02.2020 um 14:36 schrieb thufir: While I can certainly output the result to a file, and then add to a database, how would I actually send the result directly to a database? xquery version "3.0"; { for $line in db:open("people.json")//text() return   if (matches($line, "[0-9]"))  

Re: [basex-talk] Parsing MusicXML files

2019-12-29 Thread Martin Honnen
Am 29.12.2019 um 16:34 schrieb Joe Curtis: return $word, $p, $m I think you want   return ($word, $p, $m)

[basex-talk] collection('/test-db-1/bib')//Q{}libro versus collection('/test-db-1/bib')//libro

2020-03-29 Thread Martin Honnen
Using BaseX 9.3.2, why does a query collection('/test-db-1/bib')//Q{}libro return 6 items while collection('/test-db-1/bib')//libro gives 0 items? If I run collection('/test-db-1/bib')//Q{}libro, collection('/test-db-1/bib')//libro the info window shows Compiling: - rewrite

Re: [basex-talk] How to apply array:for-each on an array of arrays?

2020-03-31 Thread Martin Honnen
Am 30.03.2020 um 23:16 schrieb Ben Engbers: Hi, In textmining, the 'idf' or inverse document frequency is defined as idf(term)=ln(ndocuments / ndocuments containing term). I am working on a function that should return this idf. This function: declare function local:wordFreq_idf($nodes as

Re: [basex-talk] How to apply array:for-each on an array of arrays?

2020-03-31 Thread Martin Honnen
On 31.03.2020 18:32, Ben Engbers wrote: Hi, For (my personal) clarity, I have split up the original function in two parts: declare function local:step_one($nodes as node()*) as array(*)* { let $text := for $node in $nodes return $node/text() => tokenize() => distinct-values()

Re: [basex-talk] collection('/test-db-1/bib')//Q{}libro versus collection('/test-db-1/bib')//libro

2020-03-30 Thread Martin Honnen
Am 29.03.2020 um 16:26 schrieb Martin Honnen: Using BaseX 9.3.2, why does a query   collection('/test-db-1/bib')//Q{}libro return 6 items while   collection('/test-db-1/bib')//libro gives 0 items? If I run collection('/test-db-1/bib')//Q{}libro, collection('/test-db-1/bib')//libro

Re: [basex-talk] analyze-string

2020-04-23 Thread Martin Honnen
On 23.04.2020 15:40, Graydon Saunders wrote: So if I create a query in the BaseX 9.3.2 GUI, thus: declare function local:processMatch($in as text(),$matchPattern as xs:string) as item()+ {   let $search as element() := analyze-string(normalize-space($in),$matchPattern)   return $search }; let

Re: [basex-talk] Stack overflow with random-number-generator

2020-05-11 Thread Martin Honnen
On 11.05.2020 23:33, Joe Wicentowski wrote: I found a version that works.  In the original version I must not have been using tail recursion correctly.  Here is the version that works. Can anyone explain why the first version doesn't properly trigger tail recursion? No, but I think you can

Re: [basex-talk] Runtime load of a module?

2020-05-17 Thread Martin Honnen
Am 17.05.2020 um 16:46 schrieb Buddy Kresge: We have a situation where we have certain XQuery modules and we want to know if there is a way to load a module into BaseX at Run-time? https://docs.basex.org/wiki/XQuery_Module#xquery:parse-uri seems to allow that. The W3C library also defines

Re: [basex-talk] Serializing with xml-stylesheet prolog

2020-06-07 Thread Martin Honnen
Am 07.06.2020 um 10:25 schrieb Jay Straw: I need to run a client-side stylesheet (XSLTForms, I tried it server side, didn't work), but getting my assembled XHTML document to output with has been hard. After searching https://docs.basex.org/wiki/Serialization,

Re: [basex-talk] sum() is returning inaccurate sums

2020-06-17 Thread Martin Honnen
Am 17.06.2020 um 10:37 schrieb Jay Straw: Hi all, I'm building a budgeting system for home use, using XSLTForms and -- ready for it? -- BaseX! sum() has been behaving weird. I'm adding USD, which means only 2 decimals of precision. But depending on the combination of elements I add, I'll get a

Re: [basex-talk] sum() is returning inaccurate sums

2020-06-17 Thread Martin Honnen
Am 17.06.2020 um 10:50 schrieb Martin Honnen: Whether you do that with a long `for .. return` or simply with   //gross/xs:decimal(.) or   //gross!xs:decimal(.) is up to you. Schema-aware XQuery could also help of the `gross` elements were declared as `xs:decimal`, but I don't think XQuery

Re: [basex-talk] How to serialize HTML as text

2020-06-27 Thread Martin Honnen
Am 27.06.2020 um 18:32 schrieb Emmanuel Chateau: I need to output a JSON object with HTML content without a parent element. Weird idea I grant you, but required by the people I work with. Working from a map, in the map value, the content should not appear in a parent element. Instead of :

Re: [basex-talk] Joining large files

2020-07-11 Thread Martin Honnen
Am 11.07.2020 um 14:41 schrieb Giuseppe G. A. Celano: I am trying to perform a join operation between two large XML files (~490 MB and ~40 MB), which are the result of the automatic conversion of old sql dumps into XML files. I created two databases for the files. The query I wrote to join them

Re: [basex-talk] Joining large files

2020-07-11 Thread Martin Honnen
On 11.07.2020 14:41, Giuseppe G. A. Celano wrote: I am trying to perform a join operation between two large XML files (~490 MB and ~40 MB), which are the result of the automatic conversion of old sql dumps into XML files. I created two databases for the files. The query I wrote to join them is

Re: [basex-talk] Inserting a two double quoted attribute

2020-07-27 Thread Martin Honnen
Am 27.07.2020 um 12:01 schrieb Ramzi Hammouda: Hello BaseX team, I need to insert a node that has an attribute with two double quotes. An example: let $message:='3.00' With XML markup, to have an attribute value delimited by double quotes but to also use double quotes inside the attribute