Re: [basex-talk] using xslt 2 --- Unknown function 'current-grouping-key(...)'.

2012-09-13 Thread Imsieke, Gerrit, le-tex
Aren’t the -jar and -cp options mututally exclusive? That is, if you use 
-jar, -cp is being ignored? Maybe you should put all jars (BaseX, Saxon, 
...) in the -cp and then invoke org.basex.BaseXGUI or the like. Maybe 
adapt the startup scripts to include the Saxon jar in the cp.


Gerrit


On 2012-09-13 15:53, Alex Muir wrote:

Java is being used

On Thu, Sep 13, 2012 at 9:51 AM, Christian Grün
 wrote:

Dear Alex,

as Max stated, it would be interesting to know what xslt:processor()
gives you as result. This way, we will know if Saxon or Java is used
as processor.

Thanks,
Christian
___

On Thu, Sep 13, 2012 at 3:47 PM, Alex Muir  wrote:

As I said in the first line of my post I'm looking at that module
page. The page states that

"XSLT 2.0 is used instead if Version 9.x of the Saxon XSLT Processor
(saxon9he.jar, saxon9pe.jar, saxon9ee.jar) is found in the classpath."

I'm launching basex as follows

java -classpath
/mnt/xslt_volume/i4EnrichV7/resources/libs/saxon9he.jar -jar
/mnt/xslt_volume/i4EnrichV7/resources/libs/BaseX73.jar

Is there anything else I need to do?


On Thu, Sep 13, 2012 at 8:57 AM, Maximilian Gärber  wrote:

Hi,

did you check  http://docs.basex.org/wiki/XSLT_Module  ?

using xslt:processor() you can output if you're really using Saxon.

Regards,
Max

2012/9/13 Alex Muir :

Hi,

Following the http://docs.basex.org/wiki/XSLT_Module

I'm launching basex as follows

java -classpath
/mnt/xslt_volume/i4EnrichV7/resources/libs/saxon9he.jar -jar
/mnt/xslt_volume/i4EnrichV7/resources/libs/BaseX73.jar

I get an error thought when executing which makes me think I have not
convinced basex that saxon is there to use...

Error: Stopped at line 14, column 48 in
/mnt/xslt_volume/i4EnrichV7/analysis/xquery/AggregateSectionsTitleNormalized.xq:
[XPST0017] Unknown function 'current-grouping-key(...)'.

Query: let $in := .//section
let $sections :=

$in

let $style :=
http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:fn="http://www.w3.org/2005/xpath-functions";
xmlns:mh="http://www.metaheuristica.com"; version="2.0">



   
  
 
  
   




return xslt:transform($sections, $style)

What am I doing wrong?
Regards

--
-

Alex G. Muir
Software Engineering Consultant
Linkedin Profile : http://ca.linkedin.com/pub/alex-muir/36/ab7/125
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk




--

Maximilian Gärber

axxepta solutions GmbH
Postfach 51 02 38
13362 Berlin

Tel +49 (0)30 499 147 66
Fax +49 (0)30 499 147 67
Mail gaer...@axxepta.de
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk




--
-

Alex G. Muir
Software Engineering Consultant
Linkedin Profile : http://ca.linkedin.com/pub/alex-muir/36/ab7/125
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk






--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] using xslt 2 --- Unknown function 'current-grouping-key(...)'.

2012-09-13 Thread Imsieke, Gerrit, le-tex

Use a colon as path separator when in Unixland

On 2012-09-13 16:06, Alex Muir wrote:

I'm trying that but getting command not found

[ec2-user@soda libs]$ ls
BaseX73.jar   saxon9he.jar

[ec2-user@soda libs]$  java -cp saxon9he.jar;BaseX73.jar org.basex.BaseXGUI
...
bash: BaseX73.jar: command not found...


On Thu, Sep 13, 2012 at 9:57 AM, Christian Grün
 wrote:

  java -cp saxon9he.jar;BaseX73.jar org.basex.BaseXGUI






--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Resource doesn't exist… but it does

2012-10-22 Thread Imsieke, Gerrit, le-tex



On 2012-10-22 22:05, France Baril wrote:

Hi,

I get this error on a db:retrieve:

Stopped at line 175, column 119 in
/Users/archie/BaseXHTTP/How2_StaticHTML.xqm:
[FODC0002] Resource

'http:/localhost:8984/rest/ImagesAndGlobalContent/global/i_app_available.png'
does not exist.



Noticing that there is only one slash after 'http:' in the purported URI.

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Query slow via PHP

2012-12-05 Thread Imsieke, Gerrit, le-tex



On 2012-12-05 12:44, Christian Grün wrote:

   https://github.com/BaseXdb/basex-api/blob/master/src/main/php/BaseXClient.php

Maybe someone else on the list has some idea how the API could be


Not using PHP in the first place has improved life for many people.

Sorry, simply couldn’t resist trolling ;)


improved, or if there's any other reason for the delay?

Christian
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk



___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] 256 namespaces limit

2013-01-13 Thread Imsieke, Gerrit, le-tex

Dear Team,

Do you plan on increasing the 256 namespaces limit any time soon? I know 
that there is the STRIPNS option, but this does not fit my use case 
(which is to index all my XSLT and XProc files) too well.


Gerrit
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] losing line breaks with xslt:transform(...)

2013-07-31 Thread Imsieke, Gerrit, le-tex
Irrespective of the actual cause I’d like to reinforce my (and others’) 
point of view that chopping-by-default is non-XMLish and should be 
discarded.



On 31.07.2013 11:47, Simon Görke wrote:

Hi Christian,

I narrowed it down a little bit. Though turning it off in the xquery
prologue as proposed did not help, the problem seems actually to be linked
to the chopping option.
What I did not mention in my first posting is that the xslts are also stored
in a (second) basex database.

What I found out is that the result of the transformation is ok (i.e. with
all the line breaks required) if I *manually* create the database for the
xslts in the basex-gui and *manually* set the chopping option to off in the
creation window.

Surprisingly, when I create the databases automatically using the following
xml-snippet


  false
  
  

  

   

All databases have chopping set to off according to the GUI, but still the
line breaks are lost in the transformation ???

I also found this thread

http://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg02257.html

with a similar problem, however locally setting the chop value as proposed
is no remedy for my problem.

return (# db:chop "no" #) {
 xslt:transform($xml,$xslt)
   }

Is there a possibility to disable chopping globally ? Our databases are
either huge or contain text, but not both...

Thanks in advance
Simon




-Ursprüngliche Nachricht-
Von: Christian Grün [mailto:christian.gr...@gmail.com]
Gesendet: Dienstag, 30. Juli 2013 17:26
An: Simon Görke
Cc: BaseX
Betreff: Re: [basex-talk] losing line breaks with xslt:transform(...)

Hi Simon,

could you provide us with a minimized example that demonstrates the
(mis)behavior?

Thanks in advance
Christian
___

2013/7/30 Simon Görke :

Christian,

thanks for the hint, but no change for the better. I also tried with
the basex-internal xslt-processor (instead of saxon) but resulted in
the same problem.

Any ideas welcome...

Greets,
Simon



-Ursprüngliche Nachricht-
Von: Christian Grün [mailto:christian.gr...@gmail.com]
Gesendet: Freitag, 26. Juli 2013 14:56
An: Simon Görke
Cc: BaseX
Betreff: Re: [basex-talk] losing line breaks with xslt:transform(...)

Hi Simon,

not sure if that helps, but you can try to deactivate whitespace
chopping in the prolog of your XQuery expression:

   declare option db:chop "no";
   ...

Best,
Christian
___

2013/7/26 Simon Görke :

Hi,

I have small issue regarding the xslt:transform function (or what
lies beneath). We are currently migrating a larger number of existing
stylesheets into a basex-environment (before they were used with
saxon on the filesystem).

The problem is, that all line breaks which are generated explicitly
in the stylesheets (e.g. by using 
) get lost.
Line feeds within a xsl:text element are correctly transformed. See
below for the xslt and example output.

First we thought this might be linked to the whitespace chopping of
the database where the transformation result is stored, however I get
the same behavior when directly looking at the output of
xslt:transform(...) in the basex-gui.
Is there any options to influence this behavior? We are using saxon9
within basex version 7.6.

Thanks for your help
Simon


---
Excerpt from example stylesheet:
...


block1 line1
block1 line2




block2 line1


block2 line2




block3 line1




block3 line2





Result when running the stylesheet with saxon on the filesystem; All
line break variants actually result in new lines:

block1 zeile1
block1 zeile2
block2 zeile1
block2 zeile1
block3 zeile1
block3 zeile1

--

Result from calling xslt:transform in basex (saxon is used also
within basex); Only the line break within the xsl:text is visible in
the
output:

block1 line1
block1 line2block2 line1block2 line2block3 line1block3 line2

--



___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk




___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] dynamically evaluate XPath

2013-11-11 Thread Imsieke, Gerrit, le-tex
I have a RESTXQ path/function that is supposed to retrieve a document 
fragment, restricted to an XPath expression that is given as a query 
parameter, i.e., as a string. The list of possible fragment XPaths has 
been calculated using path() by another function, and the user of a Web 
application may choose to retrieve any of the fragments.


An example for such a path would be 
'/Q{http://www.tei-c.org/ns/1.0}TEI[1]/Q{http://www.tei-c.org/ns/1.0}text[1]/Q{http://www.tei-c.org/ns/1.0}front[1]/Q{http://www.tei-c.org/ns/1.0}div[3]'.


Is there a better solution than the following, whose performance is of 
course quite poor (around 2 seconds execution time for the given 
documents)? I’m thinking of something like saxon:evaluate() or the XSLT 
3 instruction xsl:evaluate.


Maybe I’m just unaware of the obvious solution based upon XQuery 3 or a 
BaseX extension.


Gerrit

declare
  %rest:path("/content/fragment/{$db}/{$doc}")
  %rest:query-param("xpath", "{$xpath}")
  %rest:GET
  function page:get-frags(
$db as xs:string,
$doc as xs:string,
$xpath as xs:string
  )
as item()*
{
  
{ for $doc in db:open($db, $doc)
  return $doc//*[path(.) eq $xpath] }
  
};
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] dynamically evaluate XPath

2013-11-11 Thread Imsieke, Gerrit, le-tex

Thanks Christian, that’s it!

On 11.11.2013 13:49, Christian Grün wrote:

Hi Gerrit,

you are probably looking for the xquery:eval function [1]:

   xquery:eval( "db:open('" || $db || "', '" || $doc || "')" || $xpath)

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] db:open(), xquery:eval(), and path()

2013-11-16 Thread Imsieke, Gerrit, le-tex
I think that under certain conditions, the path() function does not 
return the proper paths.


Here’s an example that works ok:

for $doc in 
let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc})
return
  for $node in $nodes
  return 

⇒
http://www.w3.org/2005/xpath-functions}root()/Q{}a[1]" 
name="a"/>
http://www.w3.org/2005/xpath-functions}root()/Q{}b[1]" 
name="b"/>
path="Q{http://www.w3.org/2005/xpath-functions}root()/Q{}b[1]/Q{}c[1]" 
name="c"/>


Now I create a database 'doc' with the document 'doc.xml' and invoke the 
slightly modified query:


for $doc in db:open('doc', 'doc.xml')/*
let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc})
return
  for $node in $nodes
  return 

⇒
http://www.w3.org/2005/xpath-functions}root()" name="a"/>
http://www.w3.org/2005/xpath-functions}root()" name="b"/>
http://www.w3.org/2005/xpath-functions}root()" name="c"/>

The element names are still known, but not their paths. Is it a bug or 
am I missing something?


Gerrit

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] db:open(), xquery:eval(), and path()

2013-11-16 Thread Imsieke, Gerrit, le-tex

Probably related:

db:node-id(xquery:eval("db:open('doc', 'doc.xml')/*"))
⇒ 0

db:node-id(db:open('doc', 'doc.xml')/*)
⇒ 1



On 16.11.2013 23:57, Imsieke, Gerrit, le-tex wrote:

I think that under certain conditions, the path() function does not
return the proper paths.

Here’s an example that works ok:

for $doc in 
let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc})
return
   for $node in $nodes
   return 

⇒
http://www.w3.org/2005/xpath-functions}root()/Q{}a[1]"
name="a"/>
http://www.w3.org/2005/xpath-functions}root()/Q{}b[1]"
name="b"/>
http://www.w3.org/2005/xpath-functions}root()/Q{}b[1]/Q{}c[1]"
name="c"/>

Now I create a database 'doc' with the document 'doc.xml' and invoke the
slightly modified query:

for $doc in db:open('doc', 'doc.xml')/*
let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc})
return
   for $node in $nodes
   return 

⇒
http://www.w3.org/2005/xpath-functions}root()" name="a"/>
http://www.w3.org/2005/xpath-functions}root()" name="b"/>
http://www.w3.org/2005/xpath-functions}root()" name="c"/>

The element names are still known, but not their paths. Is it a bug or
am I missing something?

Gerrit

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] db:open(), xquery:eval(), and path()

2013-11-17 Thread Imsieke, Gerrit, le-tex
Ah, I see. It just felt too PHPish to synthesize the whole query as a 
string, therefore I thought I might use xquery:eval() ad libitum in the 
middle of a query and that it would operate on the same database as the 
static remainder of the query.


And of course it is harder to debug if the whole query is a string, 
syntax-aware editor support is unavailable, etc.


I wanted to have a generic, configurable RESTXQ interface for retrieving 
document fragments according to fragmentation rules that are defined 
elsewhere, by means of an XPath expression. This expression may be for 
example '//*:div[not(ancestor::*:div)][not(*:divGen)]' for a certain 
class of TEI documents, or '//(*:chapter | *:part | *:appendix | 
*:preface)' for DocBook.


This expression is passed to the function sxedit:list-frags() that 
retrieves the headings of all fragments, as in 
https://github.com/gimsieke/sxedit/blob/master/lib/basex/restxq/sxedit.xqm#L90, 
and it is also supplied as an argument to the function that is supposed 
to retrieve the fragments, inserting placeholder elements whenever a 
nested fragment is encountered.


Another configurable option in that module is an expression, 
$doc-condition, that filters the available databases for documents that 
meet certain criteria, for example, '[namespace-uri(/*) = 
''http://www.tei-c.org/ns/1.0'']'.


I’ll have to deal with writing back the (edited) fragments; maybe I’ll 
contact you folks off-list soon for some guidance on forging the 
updating queries because I never did updating queries before ;)


Gerrit


On 17.11.2013 12:04, Christian Grün wrote:

Hi Gerrit,


db:node-id(xquery:eval("db:open('doc', 'doc.xml')/*"))
=> 0


some quick feedback (I'll further look into this): when running
xquery:eval, a main-memory copy of the original node is created, which
may have another node id than the original node. To get the node id of
the original node, you'll have to embed your db:node-id call into the
xquery:eval code:

   xquery:eval("db:node-id(db:open('doc', 'doc.xml')/*)")

Hope this helps,
Christian
___

On Sun, Nov 17, 2013 at 2:51 AM, Imsieke, Gerrit, le-tex
 wrote:

Probably related:


db:node-id(db:open('doc', 'doc.xml')/*)
=> 1




On 16.11.2013 23:57, Imsieke, Gerrit, le-tex wrote:


I think that under certain conditions, the path() function does not
return the proper paths.

Here's an example that works ok:

for $doc in 
let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc})
return
for $node in $nodes
return 

=>
http://www.w3.org/2005/xpath-functions}root()/Q{}a[1]"
name="a"/>
http://www.w3.org/2005/xpath-functions}root()/Q{}b[1]"
name="b"/>
http://www.w3.org/2005/xpath-functions}root()/Q{}b[1]/Q{}c[1]"
name="c"/>

Now I create a database 'doc' with the document 'doc.xml' and invoke the
slightly modified query:

for $doc in db:open('doc', 'doc.xml')/*
let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc})
return
for $node in $nodes
return 

=>
http://www.w3.org/2005/xpath-functions}root()" name="a"/>
http://www.w3.org/2005/xpath-functions}root()" name="b"/>
http://www.w3.org/2005/xpath-functions}root()" name="c"/>

The element names are still known, but not their paths. Is it a bug or
am I missing something?

Gerrit

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] transform before update query

2014-02-16 Thread Imsieke, Gerrit, le-tex
This XQuery update related question might be not the most BaseX-specific 
question that has ever been asked on the list, but anyway:


I’m currently improving the performance of sxedit (that I presented at 
XML Prague yesterday). One nasty workaround that I have to do in the 
browser is escaping the names of the TEI elements body and head when I 
generate TEI XML from HTML despite the fact that these elemens are in a 
different namespace (because browsers…). So I have TEI XML with the 
elements _head and _body. I serialize this XML and use regex 
replacement on the string when I submit the TEI XML for download or for 
storage in BaseX. (Yes, it seems silly to serialize the XML before 
POSTing it to RESTXQ and then using parse-xml(), but don’t mind that for 
the moment.)


The function that does the storage is at 
https://github.com/gimsieke/sxedit/blob/master/lib/basex/restxq/sxedit.xqm#L221


Now I thought that I might do without the performance-killing string 
replacement in the browser if I let BaseX transform the posted data 
prior to replacing the stored subtree with what was posted.


So I tried the following for the function body:

copy $doc := parse-xml($wrapper)
modify (
  for $n in $doc/descendant-or-self::*[starts-with(local-name(), 
'_')]

  let $repl := replace(local-name($n), '^_', ''),
  $uri := namespace-uri($n)
  return rename node $n as QName($uri, $repl)
)
return
replace node db:open($doc/*:frag/@db, $doc/*:frag/@doc)//*[path() 
eq $doc/*:frag/@xpath]

with $doc/*:frag/*

upon which I get:
[XUST0001] Transform expression: no updating expression allowed.

How would I achieve the transform and then update operation?

Gerrit


___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] transform before update query

2014-02-16 Thread Imsieke, Gerrit, le-tex

Christian, thanks for your XQuery support. Will pay back in XSLT support ;)

I made this change, and I also made the xquery:eval statements 
compatible with 7.8: 
https://github.com/gimsieke/sxedit/blob/master/lib/basex/restxq/sxedit.xqm


Gerrit

On 16.02.2014 15:40, Christian Grün wrote:

Hi Gerrit,

the return clause of the transform (copy) expression does not allow
update operations. What you can do is to wrap your code in a FLWOR
expression:

let $doc :=
   copy $doc := parse-xml($wrapper)
 modify (
   for $n in $doc/descendant-or-self::*[starts-with(local-name(), '_')]
   let $repl := replace(local-name($n), '^_', ''),
   $uri := namespace-uri($n)
   return rename node $n as QName($uri, $repl)
 )
 return $doc
return
 replace node db:open($doc/*:frag/@db, $doc/*:frag/@doc)//*[path()
eq $doc/*:frag/@xpath]
 with $doc/*:frag/*


You can also use the (for now BaseX-specific) "update" keyword, e. g.
as follows:

let $doc := parse-xml($wrapper) update (
   for $n in descendant-or-self::*[starts-with(local-name(), '_')]
   let $repl := replace(local-name($n), '^_', ''),
   $uri := namespace-uri($n)
   return rename node $n as QName($uri, $repl)
)
return
 replace node db:open($doc/*:frag/@db, $doc/*:frag/@doc)//*[path()
eq $doc/*:frag/@xpath]
 with $doc/*:frag/*

Hope this helps,
Christian



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Dynamic Module Loading

2014-02-24 Thread Imsieke, Gerrit, le-tex

Great idea!

And it seems as if a user will able to submit the module URI and a 
function name via RESTXQ and use this function even in an updating 
expression.


Maybe a variant of inspect:functions() could also accept a string (my 
use case: an application/xquery document that is submitted in a 
multipart RESTXQ POST request), parse it for function declarations and 
return them as function items.


You’d have one signature with an xs:anyURI argument and one with an 
xs:string argument. Or name the two functions differently and let both 
accept strings.


Gerrit


On 24.02.2014 18:32, Christian Grün wrote:

Hi Jean-Philippe,

we are still hesitant to implement a function that dynamically adds
all imported functions to the static query context. Such an extension
wouldn't allow us anymore to statically determine which of the
functions that are used in the XQuery expression do actually exist,
and which may be imported at runtime by an import-module call.

However, we could add a function that returns a sequence of all
functions declared in a specific module, and which could be browser
for a specific function. I have added this idea (inspired by our team
member Leo) and an example how to use it to GitHub [1].

Do you (and others) think that this solution would be a viable
alternative to the util:import-module function from eXist?
Christian

[1] https://github.com/BaseXdb/basex/issues/872



On Mon, Feb 24, 2014 at 4:55 PM, Christian Grün
 wrote:

Hi Jean-Philippe,


when the evaluated
expression yields function items. How should we understand this second
limitation? Because modules precisely define functions...


This means that the result of a query may not be a function, as e.g.
in the following two examples:

   xquery:eval("true#0"),
   xquery:eval("function() { 1 }")

Hope this helps,
Christian

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] restriction on number of namespaces has apparently been lifted – thank you

2014-03-20 Thread Imsieke, Gerrit, le-tex
Today I noticed that I could actually build an index of all XSLT, XProc, 
Relax NG and Schematron files on my hard disk (3316 files). I couldn’t 
do that 2 years ago because the maximum number of distinct namespaces in 
a DB was limited to 256 or so.


Thanks, BaseX team, for lifting this restriction!

This has already proved really useful: I knew that I wrote an XProc step 
that conditionally invoked a step whose local name I remembered. The 
simple XPath expression

collection('home')//*:declare-step[*:choose//*:paths]
helped me identify the two relevant files.
Since we do a lot of development in XML-syntax languages, an XML 
database is really really good for structured searches on these files. I 
bet you XQuery devs still use grep to query your code ;)


Gerrit
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] restriction on number of namespaces has apparently been lifted – thank you

2014-03-20 Thread Imsieke, Gerrit, le-tex
As Christian has pointed out in private, this limitation hasn’t been 
lifted yet. I ran into it when I tried to index all the XML files on my 
hard disk.
It worked for my code files yesterday because I switched to a new 
computer 1 year ago, and the number of code files / namespaces in them 
has not reached the critical limit yet.


So I made an issue out of it: https://github.com/BaseXdb/basex/issues/902

Gerrit

On 20.03.2014 22:54, Imsieke, Gerrit, le-tex wrote:

Today I noticed that I could actually build an index of all XSLT, XProc,
Relax NG and Schematron files on my hard disk (3316 files). I couldn’t
do that 2 years ago because the maximum number of distinct namespaces in
a DB was limited to 256 or so.

Thanks, BaseX team, for lifting this restriction!

This has already proved really useful: I knew that I wrote an XProc step
that conditionally invoked a step whose local name I remembered. The
simple XPath expression
collection('home')//*:declare-step[*:choose//*:paths]
helped me identify the two relevant files.
Since we do a lot of development in XML-syntax languages, an XML
database is really really good for structured searches on these files. I
bet you XQuery devs still use grep to query your code ;)

Gerrit

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Accessing DOCTYPE information after DB creation?

2014-03-28 Thread Imsieke, Gerrit, le-tex
You can preprocess your documents with Andrew Welch’s LexEv parser: 
http://andrewjwelch.com/lexev/


On 28.03.2014 12:25, Christian Grün wrote:

Hi Constantine,

unfortunately no, because this information is already consumed by the
XML parser (i. e., we don’t get to see it at all when the database is
being built).

Suggestions from other users with similar problems are welcome.
Christian



Hi all,

I would really like to be able to query a large corpus of documents to get
names and counts of the DTDs which are declared in the (somewhat
old-fashioned now) DOCTYPE declaration:



 

Is there any way to get BaseX to preserve this information? Can I rewrite
the doctype declaration into some sort of element node as the DB is being
created so that this info can be queried?

Thanks for any tips,
Constantine.


___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] 7.8.2 Updating function items

2014-05-04 Thread Imsieke, Gerrit, le-tex

acclaim

On 04.05.2014 21:57, Christian Grün wrote:

Et voilà...

   https://github.com/BaseXdb/basex/issues/939
   http://files.basex.org/releases/latest/

Your feedback is welcome,
Christian


Re: [basex-talk] Opened by another process

2014-11-18 Thread Imsieke, Gerrit, le-tex



On 18.11.2014 11:31, Maximilian Gärber wrote:

wow, this has to be nicest tech list on the planet

users thank themselves, receive thanks from the owners ;-)


But there are also nasty subscribers such as myself who pedantically 
insist that said users thank each other (rather than themselves, 
reflexively). So curb your enthusiasm, Max!


Gerrit




2014-11-17 23:51 GMT+01:00 Christian Grün :

Ah, that did the trick!
I changed ownership to tomcat:tomcat and now the error has disappeared.
Thanks very much for the hint Paul :-)


Thanks, too ;)
Christian




Paul


Hi Fabrice,

How would I know?

A thought that just crossed my mind: the files of the database are not
owned by root or tomcat.
Could that be an issue?
(I'm not very familiar with unix, so I don't know exactly how ownership of
a file effects processes).

Paul


Hi Paul,
Is there any basexhttp instance that could have opened the db ?

Best regards,
Fabrice
Questel/Orbit

-Message d'origine-
De : basex-talk-boun...@mailman.uni-konstanz.de
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Paul
Swennenhuis
Envoyé : lundi 17 novembre 2014 22:44
À : basex-talk@mailman.uni-konstanz.de
Objet : [basex-talk] Opened by another process

Why would I get a bxerr:BXDB0007 error "Database 'profiles' cannot be
updated, as it is opened by another process"
when executing these commands from a BaseX client:

open profiles;
xquery insert node abc into /profiles

Where "profiles" is an existing database, and /profiles an existing root
element, and I am quite positive that the database is NOT being used in
another process?

When I issue these commands on localhost it is working fine.

Paul







--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler


Re: [basex-talk] BaseX request from Saxon XSL transformation

2015-11-18 Thread Imsieke, Gerrit, le-tex
A more convenient way (at least for Java amateurs like myself) might be
to set up a RESTXQ service in BaseX and to query it using plain
fn:doc(''). At least this works for GET requests. If you need to post
something, you’ll probably need the EXPath HTTP client library [1] that
doesn’t ship with Saxon yet, apart from Florent Georges’ patch [2].

Gerrit

[1] http://expath.org/modules/http-client/
[2] https://groups.google.com/forum/#!topic/expath/PKl27uQndng


On 18.11.2015 11:38, cmarch...@oxiane.com wrote:
>  
> 
>  
> 
> Thanks, I was reading the same articles... It was just to check if
> something already exists...
> 
>  
> 
> Best regards,
> 
> Christophe
> 
>  
> 
> Le 2015-11-18 11:35, Dirk Kirsten a écrit :
> 
>> Hello Christophe,
>>
>> I've never done this, but I'd say that extension functions are the way
>> to go. If I read the saxon documentation correctly
>> (http://www.saxonica.com/html/documentation/extensibility/functions/),
>> you can use it to call Java functions from within XSLT. As BaseX is
>> written in Java you should be able to put the BaseX jar file into the
>> library path and query BaseX using Java. Many Java Examples of how to
>> query BaseX can be found at http://docs.basex.org/wiki/Java_Examples
>>
>> Cheers
>> Dirk
>>
>> On 11/18/2015 09:18 AM, cmarch...@oxiane.com wrote:
>>>
>>>  
>>>
>>>  
>>>
>>> Hello,
>>>
>>>  
>>>
>>> I have to query a BaseX database from a XSL transformation. Does
>>> someone has ever done this ? I have no idea where to look in...
>>>
>>> I use SaxonEE, so I can write an extension function, if needed...
>>>
>>>  
>>>
>>> Best regards,
>>>
>>> Christophe
>>>
>>
>> -- 
>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
>> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22

-- 
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler


Re: [basex-talk] XML embedded in JSON

2016-01-12 Thread Imsieke, Gerrit, le-tex
Actual XML elements in actual JSON documents won’t be feasible I guess.
But after you’ve transformed the JSON to XML, you can parse the escaped
strings into XML elements proper, using
http://www.w3.org/TR/xpath-functions-3/#func-parse-xml

On 13.01.2016 02:06, E. Wray Johnson wrote:
> We have JSON that has string/text values which are XML.  Is there a
> way o have the XML as sub-elements value and not be encoded/escaped
> string?
> 
> Wray Johnson
> 


Re: [basex-talk] Catalog Resolution Under Windows

2016-03-13 Thread Imsieke, Gerrit, le-tex

Hi Eliot,

I didn’t recently try it on Windows myself, but just two observations.

On 13.03.2016 01:13, Eliot Kimber wrote:

CATFILE = C:/workspace/DITA-OT2.x/catalog-dita.xml"


There is a trailing quote sign here, is this intentional? Don’t know the 
effects of unbalanced quotes here.


In any case, it might be necessary to give the location as a file: URI, 
as in file:///C:/workspace/DITA-OT2.x/catalog-dita.xml

Did you already try that?

Gerrit


Re: [basex-talk] Validate XML against RNG schema

2017-06-21 Thread Imsieke, Gerrit, le-tex

Hi Dharmendra,

The function validate:rng() seems to only accept a Relax NG *XML syntax* 
document as its 2nd argument. You can convert the rnc file to rng using 
trang and store it in the DB as a regular XML file.


Gerrit

On 6/21/17 8:20 AM, Dharmendra Singh wrote:

Hi all,

I have loaded the RNG schema using function db:store and also loaded the 
XML in the DB which has to be validated, but i am getting the error, 
below is my code:



  let $binary := db:retrieve('onix','/relaxng/publishers-51cr.rnc')
   let $schema := bin:decode-string($binary)
   return
   let $input := db:open('onix')
   return validate:rng($input, $schema)

when i run this code i get the error invalid XML charcter(20)

so what i am doing wrong here.


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler


Re: [basex-talk] Validate XML against RNG schema

2017-06-21 Thread Imsieke, Gerrit, le-tex
jing/trang is a Java tool for converting Relax NG schemas and for 
validating with these schemas. If you are using oXygen XML, it is 
integrated with the product and you can use it to convert rnc to rng.


It is maintained on Github 
(https://github.com/relaxng/jing-trang/releases), although I don’t think 
there is a binary distribution.


There is a page about trang, 
http://www.thaiopensource.com/relaxng/trang.html, although some of the 
links are broken.


The download page seems to be functional though: 
https://code.google.com/archive/p/jing-trang/downloads


Invocation is described on 
http://www.thaiopensource.com/relaxng/trang-manual.html


Gerrit

On 6/21/17 9:50 AM, Dharmendra Singh wrote:

Hi Gerrit,

Thanks for your response can you please explain what is trang is this a 
function or something else, can you please provide me the example or 
sample to convertrnc file to rng using

trang

Regards
Dharmendra Kumar Singh


On Wednesday, 21 June 2017 1:06 PM, "Imsieke, Gerrit, le-tex" 
 wrote:



Hi Dharmendra,

The function validate:rng() seems to only accept a Relax NG *XML syntax*
document as its 2nd argument. You can convert the rnc file to rng using
trang and store it in the DB as a regular XML file.

Gerrit

On 6/21/17 8:20 AM, Dharmendra Singh wrote:
 > Hi all,
 >
 > I have loaded the RNG schema using function db:store and also loaded the
 > XML in the DB which has to be validated, but i am getting the error,
 > below is my code:
 >
 >
 >  let $binary := db:retrieve('onix','/relaxng/publishers-51cr.rnc')
 >let $schema := bin:decode-string($binary)
 >return
 >let $input := db:open('onix')
 >return validate:rng($input, $schema)
 >
 > when i run this code i get the error invalid XML charcter(20)
 >
 > so what i am doing wrong here.


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de <mailto:gerrit.imsi...@le-tex.de>, 
http://www.le-tex.de <http://www.le-tex.de/>


Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler





--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler


[basex-talk] CG 40

2017-07-07 Thread Imsieke, Gerrit, le-tex
“You’ll become smart at the age of forty,” a Swabian saying goes („Mit 
40 wird man g’scheid.“, see also [1]).


If this is true, and if the (excellent) current system is the product of 
Christian’s pre-40 dabbling, how much more sophisticated will BaseX 
become from now on?


Happy birthday, Christian! Enjoy your holidays.

—Gerrit


[1] https://de.wikipedia.org/wiki/Schwabenalter


Re: [basex-talk] Could not reserve enough space for object heap

2017-08-15 Thread Imsieke, Gerrit, le-tex
It wasn’t clear to me from the OP whether the issue of *slowness* 
persisted after raising max heap to 2 GB, or whether the issue of *not 
being able to allocate this amount of space at all* persisted.


If Bram set max heap to more than 1.5 GB and immediately received the 
message “Could not reserve enough space …”, this could be an indication 
that he is running a 32-bit Java on his 64-bit machine.


Bram, what is the output of 'java -version'? Mine is:

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

If it does not contain '64-Bit', it’s 32 bit, and you need to install a 
different binary from Oracle’s site.


Gerrit

On 16.08.2017 07:53, Kirsten, Dirk wrote:

Hi Bram

How did you set the java heap space? Usual way would be by using the 
command line and setting e.g.


   java -Xmx2g

However, the object which throws the error is already nearly 1,5GB in 
size, so if other stuff has to be allocates as well it could simply be 
that it is still not enough. Try increasing it to at least 4GB.


Indicating the memory leak: Well, it could certainly be, but I 
personally doubt it. First of all, having millions of databases is a 
lot, so some performance impact is expected. And given the scale of your 
databases I wouldn't call 600ms "terribly slow", you just seem to have a 
lot of data. When you create a new database there is also stuff which 
has to be checked (I would guess for example that BaseX checks that the 
database not already exists, which runtime obviously depends on the 
number of databases you already have), so I would guess the performance 
is somewhat expected. Of course, it might be possible to optimize this 
and try to make BaseX more performant for your given scenario.


Cheers
Dirk

**
Senacor Technologies Aktiengesellschaft - Sitz: Eschborn - 
Amtsgericht Frankfurt am Main - Reg.-Nr.: HRB 105546
Vorstand: Matthias Tomann, Marcus Purzer - Aufsichtsratsvorsitzender: 
Daniel Grözinger



-Ursprüngliche Nachricht-
Von: basex-talk-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] Im Auftrag von Bram 
Vanroy

Gesendet: Dienstag, 15. August 2017 22:22
An: basex-talk@mailman.uni-konstanz.de
Betreff: [basex-talk] Could not reserve enough space for object heap

Hi all

I'm running into an issue with many databases. I.e. one server instance 
with millions of databases. When creating all of these, I found that the 
more databases are included on the instance, the slower further database 
generation got. For instance, I could see in the logs that in the first 
< 10.000 databases the creation happened smoothly with around 50ms per 
file of 1-4kB. However, when having more and more databases for this 
server instance, things got very slow: for an XML file of 1-4kB the logs 
show ~600ms. This is terribly slow, as you can imagine.


At first I thought something was wrong with my hardware, but I checked 
on another system and the same issues arises. Then I thought maybe Java 
is doing something strange, so I figured I'd reboot and see if that 
cleared some stuff up. But now when I try to launch 'basex' or 
'basexserver', I get the following message:


  Could not reserve enough space for 1433600KB object heap

I googled the issue, and it was suggested that I added a JAVA option to 
my system's variable (I'm on Windows 10 64 bit, BaseX 8.6.4) indicating 
the memory it could use. I set that to 2048MB. But still the same issue 
persists.


I have contacted the list before, with issues of generating millions of 
database with the same server instance, and this seems another one 
related to the problem. I am no expert AT ALL, but isn't it possible 
there is some sort of micro memory leak that only becomes apparent when 
creating an amount of databases of this magnitude? If not, other ideas 
are welcome as well. At least on how to get rid of the Java error 
mentioned above.



Kind regards

Bram Vanroy



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler


Re: [basex-talk] BaseX File Module : access network folder on windows server

2018-01-22 Thread Imsieke, Gerrit, le-tex

It works with a file: URI with five forward slashes, like
file:list('file:/SERVERNAME_or_IP/Freigabename/')

The results, if folders, may contain backslashes though.


On 22/01/2018 19:05, Christian Grün wrote:

Hi Dieter,

I haven’t tried Window networking by myself, but AFAIK access on
server is not possible via the File Module. It is based on Java’s
default file access, and an additional library (such as [1]) would
need to be embedded. JCIFS uses the CIFS/SMB networking protocol to
access network drives.

Sorry for that,
Christian

[1] https://jcifs.samba.org/



On Mon, Jan 22, 2018 at 1:49 PM, Dieter Zanzinger
 wrote:


I am working with den BaseX-File-Module for a while and can access a local
folder,
for example: file:list('C:/').

Now I want the same in a Windows network.
If I create a folder on the Desktop of the local machine = localhost and
give it a "Freigabe" with "Freigabename" netzlaufwerktestF, it is possible
to list it´s contents with:
file:list('//WIN7PROPARPC/netzlaufwerktestF/').

Now I try the same with a folder on a server, which I can access by windows
explorer. I expected the following to work:
file:list('//SERVERNAME_or_IP/Freigabename/')

But I get only errors.
Does anybody know the right way to access a network folder with the file
module of BaseX under windows?
(I didn´t find anything in the wiki or by google).

Thanks in advance

Dieter Zanzinger


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] xml element beginning and end space loss

2018-01-26 Thread Imsieke, Gerrit, le-tex

Hi Stefania,

You can avoid it if you create the DB with chopping switched off in the 
first place.


Or you can supply the chopping option as you go:

db:replace('MyDB', 'doc.xml', ' stefy ', map {'chop':false()})

Whitespace chooping by default is maybe the most-detested design 
decision in BaseX, at least among users of mixed content.


Luckily you can switch it off.

Gerrit


On 27/01/2018 00:53, Stefania Axo wrote:

Hi all!

is there a way to preserve the beginning and ending spaces in the 
Database xml elements?



In other words If I execute this xQuery

            db:replace("MyDB", "doc.xml", "  stefy  ")


the resulted document will be

           stefy

As you can see I lost my beginner and ending spaces.


thanks
Stefania


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] How to export a database containing xi:include to multiple files

2018-06-27 Thread Imsieke, Gerrit, le-tex

Hi Marco,

It didn’t go unanswered. Here’s Alex’s reply: 
https://mailman.uni-konstanz.de/pipermail/basex-talk/2018-May/013147.html
Although his answer doesn’t address the issue of recreating xi:include 
elements from elements with an xml:base attribute.


Gerrit

On 27.06.2018 17:34, Marco Randazzo wrote:

Hi,
I’m posting again the same question I did some time ago, unfortunately 
unanswered L


I used baseX GUI (9.0.1) to create a database similar to the following 
test file:


http://www.w3.org/2001/XInclude";>

     

     



The Result displayed in the baseX gui is correct:

http://www.w3.org/2001/XInclude";>

   

   



Now, after editing the values, I would like to export the contents of 
the database to MULTIPLE xml files, recreating the same files and the 
original folders (I see this information is not lost, it is stored in 
the value of xml:base)


However, using the export function available in the baseX GUI, I am able 
to obtain only a SINGLE file containing the Result shown above, where 
the two files have been merged in a single file.


What can I do?

Thank you,
Cheers,

Marco Randazzo



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] Re Add line-number function

2018-07-16 Thread Imsieke, Gerrit, le-tex

Hi Pavel,

What kind of editor are your users using? If they use an XML editor 
proper, there will probably be a means to jump to a location specified 
by an XPath expression.


If they are using an ordinary text editor, how do you prevent them from 
messing up the XML in the first place? Ordinary, non-IT users tend to 
render XML moot if left without appropriate tooling.


If you are a visual editor that hides the tags, it should be easier to 
insert error feedback by XPath location than by line number.


Maybe you want to create an HTML rendering of the input where you 
highlight the errors (using their XPath locations). Then the users have 
enough context to locate the erroneous piece in the original XML input.


I’m just thinking of workarounds since I assume that the notion of line 
numbers is not something that can easily be added to the BaseX storage 
layout. As someone who often deals with non-indented XML files that 
consist of a single line or with XML that is formatted&indented with 
varying line lengths, I have come to avoid relying on line number 
information altogether.


Gerrit


On 16.07.2018 08:45, Павел Павлов wrote:

Thanks for the detailed answer.

Our software is developed in .NET. And we use BaseX as a Xquery processor.
We use fn:path and return path to error element to user. But it's not 
enough.
Our users are ordinary people, not IT, and they want to see in which 
lines of xml files there are mistakes.
Now after execution of xquery by BaseX our application load xml file (in 
memory to XDocument object from .NET XML) with specified flag 
SetLineInfo. Then we execute returned xpath to select node in loaded xml 
file and get line number of selected node. Then we return line number to 
user.
That is, we have to load the file by .NET only to get the line number. 
If BaseX could do it itself we wouldn't have to load xml file at all. It 
would be a great benefit for us.


Is it possible to add some _mode_ in BaseX to store line numbers even 
with additional memory and undefined line numbers on changed or updated 
xml nodes?


Пятница, 6 июля 2018, 15:24 +07:00 от Christian Grün
:

Hi Symantis,

The original line numbers are not stored in XML databases (they may
change after updated, and would consume additional memory), so you
won’t be able to retrieve them with XQuery.

As far as I know, this does not work in eXist-db either; the eXist
link you referenced gives you the line of the util:line-number
expression in your XQuery module. As Fabrice pointed out (thanks!),
this could also be realized with $err:line-number.

With Saxon, it works indeed. However, you’ll need you use the -l
command line option (otherwise, due to performance considerations,
line numbers will be discarded as well).

On query/database level, there are two ways to get a direct reference:
• With fn:path, you get an XPath expression that points to your node.
• With db:node-pre [1], you get a direct reference to the node in a
database.

Best,
Christian

[1] http://docs.basex.org/wiki/Database_Module#db:node-id




--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] Re Re Add line-number function

2018-07-16 Thread Imsieke, Gerrit, le-tex
Still, I suggest that you do not only provide users with a list of 
errors but also with an HTML rendering of the whole document (or only of 
the erroneous bits, plus some context maybe).


Alternatively, pay BaseX GmbH in the order of (I’m just guessing) 20 
kEUR so that they enhance the storage layout to optionally include line 
numbers.


(Disclaimer: I’m making this statement as an ordinary list member. I 
don’t know about the actual cost or feasibility of adding line number 
support.)


Gerrit


On 16.07.2018 12:42, Павел Павлов wrote:

Hi!

Users send to us xml files according published xsd scheme.
And they can use any software: any xml editor or special editors, 
developed by third companies, with textbox'es for fill business objects.

So, our application does not have a graphical interface.
Our software' main goal is to validate xml files by some business logic 
rules written in xquery language. Result of such validation is xml file 
with text that is all OK or there are errors. Errors are explained by 
xpath to error node and text description with some text for example 
"Line 100: The quantity of cows must be greater than 0". Result send to 
users as answer.


And users want to see line numbers...

Hi Pavel,

What kind of editor are your users using? If they use an XML editor
proper, there will probably be a means to jump to a location specified
by an XPath expression.

If they are using an ordinary text editor, how do you prevent them from
messing up the XML in the first place? Ordinary, non-IT users tend to
render XML moot if left without appropriate tooling.

If you are a visual editor that hides the tags, it should be easier to
insert error feedback by XPath location than by line number.

Maybe you want to create an HTML rendering of the input where you
highlight the errors (using their XPath locations). Then the users have
enough context to locate the erroneous piece in the original XML input.

I?m just thinking of workarounds since I assume that the notion of line
numbers is not something that can easily be added to the BaseX storage
layout. As someone who often deals with non-indented XML files that
consist of a single line or with XML that is formatted&indented with
varying line lengths, I have come to avoid relying on line number
information altogether.

Gerrit


On 16.07.2018 08:45, ? ?? wrote:
 > Thanks for the detailed answer.
 >
 > Our software is developed in .NET. And we use BaseX as a Xquery
processor.
 > We use fn:path and return path to error element to user. But it's
not
 > enough.
 > Our users are ordinary people, not IT, and they want to see in which
 > lines of xml files there are mistakes.
 > Now after execution of xquery by BaseX our application load xml
file (in
 > memory to XDocument object from .NET XML) with specified flag
 > SetLineInfo. Then we execute returned xpath to select node in
loaded xml
 > file and get line number of selected node. Then we return line
number to
 > user.
 > That is, we have to load the file by .NET only to get the line
number.
 > If BaseX could do it itself we wouldn't have to load xml file at
all. It
 > would be a great benefit for us.
 >
 > Is it possible to add some _mode_ in BaseX to store line numbers
even
 > with additional memory and undefined line numbers on changed or
updated
 > xml nodes?
 >
 > ???, 6  2018, 15:24 +07:00 ?? Christian Gr?n
 > mailto:christian.gr...@gmail.com>>:
 >
 > Hi Symantis,
 >
 > The original line numbers are not stored in XML databases (they may
 > change after updated, and would consume additional memory), so you
 > won?t be able to retrieve them with XQuery.
 >
 > As far as I know, this does not work in eXist-db either; the eXist
 > link you referenced gives you the line of the util:line-number
 > expression in your XQuery module. As Fabrice pointed out (thanks!),
 > this could also be realized with $err:line-number.
 >
 > With Saxon, it works indeed. However, you?ll need you use the -l
 > command line option (otherwise, due to performance considerations,
 > line numbers will be discarded as well).
 >
 > On query/database level, there are two ways to get a direct
reference:
 > ? With fn:path, you get an XPath expression that points to your node.
 > ? With db:node-pre [1], you get a direct reference to the node in a
 > database.
 >
 > Best,
 > Christian
 >
 > [1] http://docs.basex.org/wiki/Database_Module#db:node-id
 >
 >

-- 
Gerrit Imsieke

Gesch?ftsf?hrer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Reg

Re: [basex-talk] Schematron package error

2018-07-22 Thread Imsieke, Gerrit, le-tex
I’m afraid we cannot help you without seeing the actual Schematron file 
that you are trying to compile/apply.


On 22.07.2018 19:59, DK Singh wrote:
Thank U Andy for your response, I have tried but it is giving schematron 
compilation error, but when I validate on Oxygen editor xmls got 
validated, as github documentation I am doing first schematron 
compilation then validating the XML, SO how can I resolve this error Now


On Sun 22 Jul, 2018, 9:39 PM James Ball, > wrote:


Hello Dharmendra,

Have you made sure that the Schematron is compiled before using it
to validate? I think this is the error you get if you try to use an
un-compiled Schematron file to perform a validation.

The necessary steps are outlined with the module documentation on
GitHub and I had it working successfully just a week ago.

Regards, James

 > Date: Fri, 20 Jul 2018 17:07:30 +0530
 > From: DK Singh mailto:dharam.m...@gmail.com>>
 > To: BaseX mailto:basex-talk@mailman.uni-konstanz.de>>
 > Subject: [basex-talk] Schematron package error
 > Message-ID:
 > 
  mailto:twju9kw...@mail.gmail.com>>

 > Content-Type: text/plain; charset="utf-8"
 >
 > Hi All,
 >
 > I am doing the schematron validation against XML docuemnt but i
am getting
 > these errors.
 >
 > Bad name element: XPath error. No XPath. Bad name element: XPath
error. No
 > XPath. Error on line 1409 column 61 of iso_dsdl_include.xsl: Too many
 > nested template or function calls. The stylesheet may be looping. at
 > xsl:call-template name="sch-check:strip-strings"
 >

(file:///C:/Program%20Files%20(x86)/BaseX/repo/http-github.com-Schematron-schematron-basex-1.2/content/iso-schematron/iso_dsdl_include.xsl#1409)
 >
 >
 > it looks like basex schematron pacakge throwing the error to run
schematron
 > validation.
 > can anyone suggest how can i resolve this errors.
 >
 > Regards
 > Dharmendra Kumar Singh
 > -- next part --
 > An HTML attachment was scrubbed...
 > URL:


 >



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] Schematron package error

2018-07-22 Thread Imsieke, Gerrit, le-tex
I ran it successfully on Windows with BaseX 8.6.5 and schematron-basex 
1.2, both when I used proper file: URIs and Windows file system paths 
with backslashes.


I used both the version of /docbook-mods.sch.xml that you sent me and a 
version with expanded entities (using xmllint --noent --dropdtd first).


When I gave it too little stack size (-Xss108k) on startup, I could only 
provoke a "Stack Overflow: Try tail recursion?" BaseX error, not the 
"Too many nested template calls" Saxon error that you reported.
Calling Saxon directly for applying iso_dsdl_include.xsl on the schema 
was also successful if heap and stack sizes were large enough.


What happens when you apply your Saxon EE standalone, transforming the 
schema with iso_dsdl_include.xsl?


Which version of Saxon 9 EE are you using?

Gerrit

On 22.07.2018 20:36, DK Singh wrote:
I Am using Saxon 9ee in the class path as well I have put it into basex 
lib directory


On Mon 23 Jul, 2018, 12:04 AM Imsieke, Gerrit, le-tex, 
mailto:gerrit.imsi...@le-tex.de>> wrote:


Is saxon9he.jar or another Saxon version on the classpath as per

https://github.com/Schematron/schematron-basex#user-content-using-xpath-20-and-above

?
The Schematron schema says queryBinding="xslt2" and this requires an
XSLT 2 processor.

On 22.07.2018 20:26, DK Singh wrote:
 > PFA
 >
     > On Sun 22 Jul, 2018, 11:47 PM Imsieke, Gerrit, le-tex,
 > mailto:gerrit.imsi...@le-tex.de>
<mailto:gerrit.imsi...@le-tex.de <mailto:gerrit.imsi...@le-tex.de>>>
wrote:
 >
 >     I didn’t get a message with a Schematron from you.
 >
 >     On 22.07.2018 20:05, DK Singh wrote:
 >      > Hi,
 >      > Already I have attached the schematron in the chain Mail
 >      >
 >      > On Sun 22 Jul, 2018, 11:33 PM Imsieke, Gerrit, le-tex,
 >      > mailto:gerrit.imsi...@le-tex.de> <mailto:gerrit.imsi...@le-tex.de
<mailto:gerrit.imsi...@le-tex.de>>
 >     <mailto:gerrit.imsi...@le-tex.de
<mailto:gerrit.imsi...@le-tex.de> <mailto:gerrit.imsi...@le-tex.de
<mailto:gerrit.imsi...@le-tex.de>>>>
 >     wrote:
 >      >
 >      >     I’m afraid we cannot help you without seeing the actual
 >     Schematron file
 >      >     that you are trying to compile/apply.
 >      >
 >      >     On 22.07.2018 19:59, DK Singh wrote:
 >      >      > Thank U Andy for your response, I have tried but it
is giving
 >      >     schematron
 >      >      > compilation error, but when I validate on Oxygen editor
 >     xmls got
 >      >      > validated, as github documentation I am doing first
schematron
 >      >      > compilation then validating the XML, SO how can I
resolve this
 >      >     error Now
 >      >      >
 >      >      > On Sun 22 Jul, 2018, 9:39 PM James Ball,
 >     mailto:m...@jamesball.co.uk>
<mailto:m...@jamesball.co.uk <mailto:m...@jamesball.co.uk>>
 >      >     <mailto:m...@jamesball.co.uk <mailto:m...@jamesball.co.uk>
<mailto:m...@jamesball.co.uk <mailto:m...@jamesball.co.uk>>>
 >      >      > <mailto:m...@jamesball.co.uk
<mailto:m...@jamesball.co.uk> <mailto:m...@jamesball.co.uk
<mailto:m...@jamesball.co.uk>>
 >     <mailto:m...@jamesball.co.uk <mailto:m...@jamesball.co.uk>
<mailto:m...@jamesball.co.uk <mailto:m...@jamesball.co.uk>>>>> wrote:
 >      >      >
 >      >      >     Hello Dharmendra,
 >      >      >
 >      >      >     Have you made sure that the Schematron is
compiled before
 >      >     using it
 >      >      >     to validate? I think this is the error you get
if you
 >     try to
 >      >     use an
 >      >      >     un-compiled Schematron file to perform a
validation.
 >      >      >
 >      >      >     The necessary steps are outlined with the module
 >     documentation on
 >      >      >     GitHub and I had it working successfully just a
week ago.
 >      >      >
 >      >      >     Regards, James
 >      >      >
 >      >      >      > Date: Fri, 20 Jul 2018 17:07:30 +0530
 >      >      >      > From: DK Singh mailto:dharam.m...@gmail.com>
 >     <mailto:dharam.m...@gmail.com <mailto:dharam.m...@gmail.com>>
 >      >     <mailto:dharam.m...@gmail.com
<mailto:dharam.m...@gmail.com> <mailto:dharam.m...@gmail.

Re: [basex-talk] Can't get `cdata-section-elements` to work at all for XSLT output

2018-08-01 Thread Imsieke, Gerrit, le-tex

Hi Hugh,

The second version where you specify the serialization options in XQuery 
works for me (BaseX GUI 8.6.5 with Saxon PE 9.6.0.7):



http://backend.userland.com/rss2"; 
xmlns:content="http://purl.org/rss/1.0/modules/content/"; version="2.0">

  
  
  


The first version cannot generate CDATA sections since the XSLT 
processor is not serializing anything; it’s the XQuery processor that 
serializes the result.


The error that you are seeing, XPST0081, would be generated if there 
were no namespace declaration for the prefix 'content', maybe caused by 
an indistinguishable look-alike non-ASCII character in 'content'. 
Doesn’t seem to be the case. Maybe this is a bug that is specific to 
BaseX 9?


Gerrit


On 01.08.2018 21:17, Hugh Guiney wrote:

Hello,

First off, loving BaseX so far! Using it as the backend for an API I’m
building. However, I’m running into an issue. I’m trying to transform
my database XML into an RSS 2.0 feed. It’s mostly working fine, but I
can’t output CDATA content at all, which I need to do for
`content:encoded` elements.

Specs:

- BaseX 9.0.2 (started via basexserver script)
- Saxon-HE 9.8.0.12J from Saxonica
- java version "1.8.0_112"
- basex 0.9.0 (NodeJS)
- macOS Sierra 10.12.6

### First Attempt

I set `cdata-section-elements` in the XSLT.

rss.xq:
```
xquery version "3.0";
declare option output:omit-xml-declaration "no";

let $in :=
   
 hello
   
let $style := doc( 'rss.xslt' )
return xslt:transform( $in, $style )
```

rss.xslt:
```

http://backend.userland.com/rss2";
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:content="http://purl.org/rss/1.0/modules/content/";



   
   
 
   hi
   howdy
   
 
   

```

Result:
```

http://backend.userland.com/rss2";
xmlns:content="http://purl.org/rss/1.0/modules/content/";
version="2.0">
   hi
   howdy
   hello

```

No CDATA sections.

### Second Attempt

I set `cdata-section-elements` in the XQuery.

rss.xq:
```
xquery version "3.0";
declare namespace content = "http://purl.org/rss/1.0/modules/content/";;
declare option output:omit-xml-declaration "no";
declare option output:cdata-section-elements "content:encoded";

let $in :=
   
 hello
   
let $style := doc( 'rss.xslt' )
return xslt:transform( $in, $style )
```

rss.xslt:
[Unchanged]

Result:
[XPST0081] No namespace declared for 'content:encoded'.

Clearly I declared the namespace two lines up.

This looks like a bug to me, but any help appreciated if I’ve missed a
step here.

Thanks,
Hugh



Re: [basex-talk] Can't get `cdata-section-elements` to work at all for XSLT output

2018-08-02 Thread Imsieke, Gerrit, le-tex

Hi Hugh,

Did you see Christian’s reply, archived at 
https://mailman.uni-konstanz.de/pipermail/basex-talk/2018-August/013490.html⁠?


He essentially said that, for your second approach, he saw the same 
behavior on BaseX 9.x as I saw on 8.6.5. So there doesn’t seem to be a 
regression.


I agree with you that xslt:transform-text() is not a solution.

Gerrit


On 01.08.2018 23:47, Hugh Guiney wrote:

Thanks for testing Gerrit, that's good to know. Sounds like a
regression then. Shall I go ahead and file this on Github or does it
need further confirmation?

Christian, your suggestion seems to work around the issue; the CDATA
sections do come in that way. Except, all the elements get sent back
entity-escaped for some reason. I have to manually reverse it back
into XML using `result.replace( />/gi, '>' ).replace( /</gi, '<'
)` in JavaScript. Not sure if that is a separate issue or expected
behavior.

On Wed, Aug 1, 2018 at 2:50 PM, Imsieke, Gerrit, le-tex
 wrote:

Hi Hugh,

The second version where you specify the serialization options in XQuery
works for me (BaseX GUI 8.6.5 with Saxon PE 9.6.0.7):


http://backend.userland.com/rss2";
xmlns:content="http://purl.org/rss/1.0/modules/content/"; version="2.0">
   
   
   


The first version cannot generate CDATA sections since the XSLT processor is
not serializing anything; it’s the XQuery processor that serializes the
result.

The error that you are seeing, XPST0081, would be generated if there were no
namespace declaration for the prefix 'content', maybe caused by an
indistinguishable look-alike non-ASCII character in 'content'. Doesn’t seem
to be the case. Maybe this is a bug that is specific to BaseX 9?

Gerrit



On 01.08.2018 21:17, Hugh Guiney wrote:


Hello,

First off, loving BaseX so far! Using it as the backend for an API I’m
building. However, I’m running into an issue. I’m trying to transform
my database XML into an RSS 2.0 feed. It’s mostly working fine, but I
can’t output CDATA content at all, which I need to do for
`content:encoded` elements.

Specs:

- BaseX 9.0.2 (started via basexserver script)
- Saxon-HE 9.8.0.12J from Saxonica
- java version "1.8.0_112"
- basex 0.9.0 (NodeJS)
- macOS Sierra 10.12.6

### First Attempt

I set `cdata-section-elements` in the XSLT.

rss.xq:
```
xquery version "3.0";
declare option output:omit-xml-declaration "no";

let $in :=

  hello

let $style := doc( 'rss.xslt' )
return xslt:transform( $in, $style )
```

rss.xslt:
```

http://backend.userland.com/rss2";
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:content="http://purl.org/rss/1.0/modules/content/";






  
hi
howdy

  


```

Result:
```

http://backend.userland.com/rss2";
xmlns:content="http://purl.org/rss/1.0/modules/content/";
version="2.0">
hi
howdy
hello

```

No CDATA sections.

### Second Attempt

I set `cdata-section-elements` in the XQuery.

rss.xq:
```
xquery version "3.0";
declare namespace content = "http://purl.org/rss/1.0/modules/content/";;
declare option output:omit-xml-declaration "no";
declare option output:cdata-section-elements "content:encoded";

let $in :=

  hello

let $style := doc( 'rss.xslt' )
return xslt:transform( $in, $style )
```

rss.xslt:
[Unchanged]

Result:
[XPST0081] No namespace declared for 'content:encoded'.

Clearly I declared the namespace two lines up.

This looks like a bug to me, but any help appreciated if I’ve missed a
step here.

Thanks,
Hugh





--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] diacritics sensitive not working

2018-08-03 Thread Imsieke, Gerrit, le-tex

Hi Ron,

You can add an extra element (or attribute) to the content when 
importing or modifying it. (Or another document in another database if 
you like – you can create and later find such an index document by 
giving it the same db:path as the original document.)


In this extra database, document, element and/or attribute, you can 
recreate the original text, except that you normalize the characters 
with diacritical marks to a canonical decomposition form and then strip 
away the diacritical marks like this:


replace(normalize-unicode($input, 'NFKD'), '\p{Mn}', '')

The full updating statement is beyond my cursory XQuery capabilities – 
I’d probably do it in XSLT. Also I don’t know how to trigger an event 
that would cause an update of the auxiliary fields when the underlying 
data changes.


Gerrit


On 03.08.2018 14:39, Ron Katriel wrote:

Christian,

Adding diacritics sensitive slows execution by a factor of 3. My script 
(fragment below), which joins two large databases, namely CT.gov 
 and DrugBank, takes 2 hours without the 
diacritics sensitive constraint but 6 hours with it. Given the 
combinatorics involved, I am wondering if there is a better way to do 
this in BaseX.


Thanks,
Ron


for $drug in db:open('DrugBank')/drugbank/drug
  let $drug_name := $drug/name/text()
  let $drug_synonyms := 
functx:value-union(normalize-space(lower-case($drug/name)), 
local:drug-synonyms($drug_name))

  for $synonym_name in $drug_synonyms
  ...
  for $study in 
db:open('CTGov')/clinical_study[intervention/intervention_name contains 
text { $synonym_name } using case insensitive using diacritics sensitive]

  ...


Ron Katriel, Ph.D. | Principal Data Scientist | Medidata Solutions 


350 Hudson Street, 7th Floor, New York, NY 10014
rkatr...@mdsol.com  | direct: +1 201 337 3622 
 | mobile: +1 201 675 5598 
 | main: +1 212 918 1800 



On August 1, 2018 at 12:41:26 PM, Ron Katriel (rkatr...@mdsol.com 
) wrote:


Thanks, Christian. Strange, prior to contacting you and on a hunch, I 
tried adding the missing “using” keyword but still got the syntax 
error. Anyway, everything is good now!


Best,
Ron

On August 1, 2018 at 3:57:51 AM, Christian Grün 
(christian.gr...@gmail.com ) wrote:



I have fixed the example in the doc.
Best, Christian


On Wed, Aug 1, 2018 at 5:08 AM Ron Katriel > wrote:

>
> Hi,
>
> The following from your website (docs.basex.org/wiki/Full-Text 
) appears to be syntactically 
incorrect

>
> "'Äpfel' will not be found..." contains text "Apfel" diacritics sensitive
>
> In the BaseX GUI the keyword diacritics is underlined in red and the 
following error is reported
>
> Unexpected end of query: 'diacritic sens...'.
>
> This happens in version 8.6.4 and also the latest (9.0.2).
>
> Thanks,
> Ron
>
>
> Ron Katriel, Ph.D. | Principal Data Scientist | Medidata Solutions
>
> 350 Hudson Street, 7th Floor, New York, NY 10014
>
> rkatr...@mdsol.com  | direct: +1 201 337 
3622 | mobile: +1 201 675 5598 | main: +1 212 918 1800

>
>




Re: [basex-talk] many distinct namespaces

2018-10-31 Thread Imsieke, Gerrit, le-tex

Hi Sergei,

The corresponding issue will turn 5 next March: 
https://github.com/BaseXdb/basex/issues/902


If you are an XML developer who wants to index all the XML, XSLT, XProc, 
RNG, XSD, Schematron, etc. files on your hard disk in an XML database, 
chances are that you’ll need more than 256 namespaces.


I’m willing to shell out up to 1,200 Euros (plus VAT) out of my own 
pockets for this feature. Any other funders?
Christian, how much do we need to raise collectively for you to 
prioritize storage layout redesign?


Gerrit

On 31.10.2018 22:47, Сергей Чесноков wrote:


Hi all,

Is it possible to bypass the following restriction (I cannot change 
"ep_ins_med_q.xsd" (Central Bank xbrl scheme))?:


BaseX 9.1

Command:
CREATE DB bfo 
D:/portal/xbrl/CBR/final_1_3_1/Taxonomy_1_3_1/www.cbr.ru/xbrl/bfo/

Error:
"D:/portal/xbrl/CBR/final_1_3_1/Taxonomy_1_3_1/www.cbr.ru/xbrl/bfo/rep/2018-03-31/ep/ep_ins_med_q.xsd""ep_ins_med_q.xsd" 
(Line 21): Too many distinct namespaces (limit: 256).


Best regards, Sergei.


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] many distinct namespaces

2018-11-02 Thread Imsieke, Gerrit, le-tex
One approach to avoid migration and backwards compatibility issues would 
be to support a standard storage and an extended storage side by side.
The storage and query functions would know beforehand which layout 
variant the current database is in, and they could use the appropriate 
optimized functions.
If dynamic lookup of these layout-specific functions would be too 
costly, maybe providing two separate binaries (classic and extended 
storage) might be an option. I cannot fathom how many pieces of code 
need to be modified in order to be able to maintain a common codebase 
for both layouts.
I’m certainly naïve in this regard because back in the days, I thought: 
How hard can it be to move from a 16 bit architecture to a 32 bit 
architecture?


Gerrit


On 02.11.2018 17:25, Christian Grün wrote:

Hi Gerrit,

thanks for your generous offer to sponsor the requested feature. I am
ashamed to confirm it’s been a long time since this issue has been
opened and not closed yet. You are asking how much money will be
required to get this fixed. I’m not sure after all. Maybe I would
rather ask for 3, 4 weeks of “leisure time”, or – even better – get a
proposal into my hands how this could be resolved without compromising
backward conformance.

Some more details: The current storage layout per node has been fixed
to 16 bytes. One byte (8 bits) is reserved for the namespace
reference. The other 15 bytes (minus a few unused bits) are reserved
for other references and flags. We could extend the storage to 24 or
32 bits. As a result, the central database main table would get
larger, so this would affect both old databases (that need to be
imported) and the overall performance of the system. If we decide to
go this step, we could indeed overcome various of the current
limitations.

Any volunteers out there who are ready for the challenge?
Christian



On Wed, Oct 31, 2018 at 11:40 PM Imsieke, Gerrit, le-tex
 wrote:


Hi Sergei,

The corresponding issue will turn 5 next March:
https://github.com/BaseXdb/basex/issues/902

If you are an XML developer who wants to index all the XML, XSLT, XProc,
RNG, XSD, Schematron, etc. files on your hard disk in an XML database,
chances are that you’ll need more than 256 namespaces.

I’m willing to shell out up to 1,200 Euros (plus VAT) out of my own
pockets for this feature. Any other funders?
Christian, how much do we need to raise collectively for you to
prioritize storage layout redesign?

Gerrit

On 31.10.2018 22:47, Сергей Чесноков wrote:


Hi all,

Is it possible to bypass the following restriction (I cannot change
"ep_ins_med_q.xsd" (Central Bank xbrl scheme))?:

BaseX 9.1

Command:
CREATE DB bfo
D:/portal/xbrl/CBR/final_1_3_1/Taxonomy_1_3_1/www.cbr.ru/xbrl/bfo/
Error:
"D:/portal/xbrl/CBR/final_1_3_1/Taxonomy_1_3_1/www.cbr.ru/xbrl/bfo/rep/2018-03-31/ep/ep_ins_med_q.xsd""ep_ins_med_q.xsd"
(Line 21): Too many distinct namespaces (limit: 256).

Best regards, Sergei.


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] supporting XML Catalog files in xslt:transform() (patch)

2019-03-13 Thread Imsieke, Gerrit, le-tex




On 13.03.2019 19:55, Liam R. E. Quin wrote:

Yes, they are a bit of a nightmare. Actually i’ve thought about having
the ability to write a URI Resolver in XQuery,
 db:resolve-identifier($system, $public, $purpose, $types) as
xs:anyURI?

but maybe it is too scary!


I’ve already written a catalog resolver in XSLT…
https://github.com/transpect/xslt-util/blob/master/xslt-based-catalog-resolver/xsl/resolve-uri-by-catalog.xsl


Re: [basex-talk] supporting XML Catalog files in xslt:transform() (patch)

2019-03-14 Thread Imsieke, Gerrit, le-tex




On 14.03.2019 10:56, Christian Grün wrote:

Maybe we could port Gerrit’s code to XQuery… Volunteers are welcome ;)


You probably can’t instruct Saxon to use the XSLT-based resolver (or an 
XQuery-based resolver) when reading XML files using doc() or xsl:import. 
I think it needs Java classes that provides certain interfaces. Not sure 
whether it makes sense to provide a Java class that executes XQuery when 
you can use a resolver that is written directly in Java.


Background for our XSLT-based resolver: We are using it in order to 
resolve canonical URIs of fonts or other resources that we need to read 
from the file system from within XSLT stylesheets or XProc pipelines, 
but that cannot be read by doc() (since they are not XML) or the EXPath 
file module methods (since Saxon won’t use the catalog resolver for 
file:read-binary()). However, we still want to be able to refer to these 
resources by a canonical URI such as 
http://transpect.io/fontlib/dejavu-sans/condensed-regular/DejaVuSansCondensed.ttf 
(which refers to a local copy of 
https://subversion.le-tex.de/common/fontlib/dejavu-sans/condensed-regular/DejaVuSansCondensed.ttf, 
using https://subversion.le-tex.de/common/fontlib/xmlcatalog/catalog.xml 
for the resolution).


A detail: We usually rely on the XML catalog resolver to resolve the URI 
to the XML catalog that we supply to the XSLT-based resolver. In a 
typical transpect project, the canonical catalog URI is at 
http://this.transpect.io/xmlcatalog/catalog.xml which resolves to 
{local_project_base_uri}/xmlcatalog/catalog.xml. Then we use this 
catalog to resolve URIs of non-XML resources.




Re: [basex-talk] Compare List Membership in XQuery

2019-03-25 Thread Imsieke, Gerrit, le-tex
Are you sure that the @target attributes are supposed to be identical to 
the IDs? Don’t you prepend a pound sign to @target attributes when they 
point to IDs within the same document?

So you probably need to say

where not(substring($title/@target,2) = $biblStruct) and 
not(substring($title/@target,2) = $biblFull)


And maybe you need to restrict the titles that you search to those with 
a @target attribute, like so:


for $title in collection('edil_target/eDIL-A.xml')//entry//title[@target]

Otherwise also non-@target-bearing titles will match the where clause, 
which may be unintended.


Gerrit

On 25.03.2019 23:32, Chris Yocum wrote:

Hi Markus,


try

for $title in collection('edil_target/eDIL-A.xml')//entry//title
where not($title/@target = $biblStruct) and not($title/@target = $biblFull)
return $title


Thank you for the quick reply at such a late hour!  However, I am
getting the same results sadly.  These results I can open the files
and find the targets that are being return in either of the two lists.

All the best,
Chris


Re: [basex-talk] Compare List Membership in XQuery

2019-03-25 Thread Imsieke, Gerrit, le-tex
If you are allowed to share some snippets of the actual documents, it 
will be easier to see how the query needs to be phrased.


Have you verified that $biblFull and $biblStruct actually contain 
strings? If not, do you need to declare a default namespace? The 
vocabulary looks like TEI, so


declare default element namespace "http://www.tei-c.org/ns/1.0";;

may be necessary. And if it is TEI, the ID attributes are probably 
called @xml:id rather than @id.


Gerrit

On 26.03.2019 00:18, Chris Yocum wrote:

Hi Gerrit,


Are you sure that the @target attributes are supposed to be identical to the
IDs?


Yes, they should be.  If they are not, I need to find them so I can
fix them to be identical.


Don’t you prepend a pound sign to @target attributes when they point to
IDs within the same document?


They are not in the same document.  The @target attributes live spread
out in the other documents while the IDs all live in the same
document.


So you probably need to say

where not(substring($title/@target,2) = $biblStruct) and
not(substring($title/@target,2) = $biblFull)



I will give this a shot tomorrow when I am not as tired.


And maybe you need to restrict the titles that you search to those with a
@target attribute, like so:

for $title in collection('edil_target/eDIL-A.xml')//entry//title[@target]



This is the other half of the problem which I did not state here. I am
to find all titles that do not have target attributes then give them a
target attribute based on some rules.  I have done so in a few files
(and I explicitly testing one of them in the query in my previous
email) and I will roll out the fix in all other files once I have
everything else tested and working.

I will give your suggestion a try tomorrow. Thanks!

All the best,
Chris





Re: [basex-talk] BaseX GUI just spins?

2019-08-21 Thread Imsieke, Gerrit, le-tex




On 21.08.2019 13:24, Buddy Kresge wrote:
Thanks for these ideas and will try these.  As far as #4, what is 
‘SSCCE’ – sorry in advance for the not recognizing (ha ha).


LMGTFY…

http://letmegooglethat.com/?q=SSCCE

SCNR

– Gerrit


Re: [basex-talk] Method to transform XQuery output to HTML!!

2012-05-09 Thread Imsieke, Gerrit, le-tex

http://docs.basex.org/wiki/XSLT_Module

On 2012-05-09 09:49, Anand Chiney wrote:

Dear BaseX Team,


Is there any function/method by which I can transform the Xquery output
to HTML file using XSLT?
A simple method or like where I can pass the XSLT File and get HTML
output easily...!!

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] How do I prevent BaseX from insisting on adding these supposed HTML attributes?

2012-05-09 Thread Imsieke, Gerrit, le-tex
It isn’t the fault of BaseX. The parser (tagsoup, if you choose HTML 
parsing) inserts the default values for attributes. You should be able 
to suppress it by adding nodefaults=true to HTMLOPT.




On 2012-05-09 17:07, jida...@jidanni.org wrote:

"AH" == Alexander Holupirek  writes:

AH>  Please post a small snippet or example, so that we are able to test the 
problem.

Taking the example from the Debian basex man page, we add an innocent
  and:

cat>  bad.html<<\EOF
   
 
   Az
   B
 
   
EOF
basex -c 'set parser html; set htmlopt method=html,nons=true; create db htmldb 
bad.html'
basex -q "doc('htmldb')"


   
 
   Az  HORRIBLE
   
   B  TERRIBLE
   
 
   


How can I stop basex from insisting on adding such atrocious junk?
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Error using transform method (XSLT Module)

2012-05-11 Thread Imsieke, Gerrit, le-tex

err:FODC0002, Error retrieving resource.
http://www.w3.org/TR/xpath-functions-30/#ERRFODC0002

Since the chapters are already in the database (as XML nodes), it must 
be the stylesheet. Is you XSL stylesheet well-formed XML? Did you use an 
empty  element there, or did you just type the opening  
tag? But then it won’t run with any standalone processor, either.


Gerrit

On 2012-05-11 13:14, Anand Chiney wrote:

Hi there,

I am using BaseX 7.2 Beta.

I am trying to extract certain XML Documents from the DB and then
applying the XSLT
to convert these docs to HTML.

Following is the query, which I am typing in Editor -

let $in := /Chapters
let $style := doc('C:\Program Files\BaseX\data\chapter.xslt')
return {(
   xslt:transform($in, $style),
   xslt:transform($in, $style)
)}


I am getting error message -
*Error: [FODC0002] "" (Line 34):  found,  expected.*

First I thought that,  tag might be compulsory. So I added the same
to the XSLT file. Still error

What does it means? Am I doing anything wrong?

The XSLT works correctly when used individually with Java code.

Ready to sent the XML and XSLT File

--
Regards

Have a nice day :)
Anand C



___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Full-text search and mixed content

2012-05-11 Thread Imsieke, Gerrit, le-tex



On 2012-05-11 23:34, Michael Piotrowski wrote:

Frankly, I find it quite dangerous that CHOP is ON by default.
Discarding whitespace in mixed content means losing information.  I'd
find it preferable if it were off by default; if you know your data and
if you are aware of the effects of CHOP, *then* you could turn it on.


+1

Whitespace should always be preserved, unless the parser strips it 
because it knows that it’s ignorable whitespace (because it has been 
made aware of a schema?).


Looking at Saxon’s strip option, 
http://www.saxonica.com/documentation/javadoc/net/sf/saxon/s9api/WhitespaceStrippingPolicy.html


Saxon’s -strip:ignorable has a certain appeal, but when you consider how 
“ignorable” is specified:

> The value IGNORABLE indicates that whitespace text nodes in
> element-only content are discarded.
fringe cases instantly come to your mind where it will strip a 
whitespace too much:

Hello World

“element-only content:”
I’m not sure whether Saxon decides that it is in element-only content 
based upon information from the parser (“no text node allowed here”) or 
whether it draws its own conclusions (“no text node present here”).


Hmm.
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Full-text search and mixed content

2012-05-11 Thread Imsieke, Gerrit, le-tex



On 2012-05-12 00:09, Imsieke, Gerrit, le-tex wrote:

I’m not sure whether Saxon decides that it is in element-only content
based upon information from the parser (“no text node allowed here”) or
whether it draws its own conclusions (“no text node present here”).


s/no text node/no non-WS text node/g;

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] basex OOM on 30GB database upon running /dba/db-optimize/

2019-10-03 Thread Imsieke, Gerrit, le-tex

Hi,

just saying that 16 GB of DDR3 RAM cost about 40 € now.

Gerrit

On 03.10.2019 08:53, first name last name wrote:

I tried again, using SPLITSIZE = 12 in the .basex config file
The batch(console) script I used is attached mass-import.xq
This time I didn't do the optimize or index creation post-import, but 
instead, I did it as part of the import similar to what

is described in [4].
This time I got a different error, that is, 
"org.basex.core.BaseXException: Out of Main Memory.*"*
So right now.. I'm a bit out of ideas. Would AUTOOPTIMIZE make any 
difference here?


Thanks

[4] http://docs.basex.org/wiki/Indexes#Performance


On Wed, Oct 2, 2019 at 11:06 AM first name last name 
mailto:randomcod...@gmail.com>> wrote:


Hey Christian,

Thank you for your answer :)
I tried setting in .basex the SPLITSIZE = 24000 but I've seen the
same OOM behavior. It looks like the memory consumption is moderate
until when it reaches about 30GB (the size of the db before
optimize) and
then memory consumption spikes, and OOM occurs. Now I'm trying with
SPLITSIZE = 1000 and will report back if I get OOM again.
Regarding what you said, it might be that the merge step is where
the OOM occurs (I wonder if there's any way to control how much
memory is being used inside the merge step).

To quote the statistics page from the wiki:
Databases  in BaseX are
light-weight. If a database limit is reached, you can distribute
your documents across multiple database instances and access all of
them with a single XQuery expression.
This to me sounds like sharding. I would probably be able to split
the documents into chunks and upload them under a db with the same
prefix, but varying suffix.. seems a lot like shards. By doing this
I think I can avoid OOM, but if BaseX provides other, better, maybe
native mechanisms of avoiding OOM, I would try them.

Best regards,
Stefan


On Tue, Oct 1, 2019 at 4:22 PM Christian Grün
mailto:christian.gr...@gmail.com>> wrote:

Hi first name,

If you optimize your database, the indexes will be rebuilt. In this
step, the builder tries to guess how much free memory is still
available. If memory is exhausted, parts of the index will be split
(i. e., partially written to disk) and merged in a final step.
However, you can circumvent the heuristics by manually assigning a
static split value; see [1] for more information. If you use the
DBA,
you’ll need to assign this value to your .basex or the web.xml file
[2]. In order to find the best value for your setup, it may be
easier
to play around with the BaseX GUI.

As you have already seen in our statistics, an XML document has
various properties that may represent a limit for a single database.
Accordingly, these properties make it difficult to decide for the
system when the memory will be exhausted during an import or index
rebuild.

In general, you’ll get best performance (and your memory consumption
will be lower) if you create your database and specify the data
to be
imported in a single run. This is currently not possible via the
DBA;
use the GUI (Create Database) or console mode (CREATE DB command)
instead.

Hope this helps,
Christian

[1] http://docs.basex.org/wiki/Options#SPLITSIZE
[2] http://docs.basex.org/wiki/Configuration



On Mon, Sep 30, 2019 at 7:09 AM first name last name
mailto:randomcod...@gmail.com>> wrote:
 >
 > Hi,
 >
 > Let's say there's a 30GB dataset [3] containing most
threads/posts from [1].
 > After importing all of it, when I try to run
/dba/db-optimize/ on it (which must have some corresponding
command) I get the OOM error in the stacktrace attached. I am
using -Xmx2g so BaseX is limited to 2GB of memory (the machine
I'm running this on doesn't have a lot of memory).
 > I was looking at [2] for some estimates of peak memory usage
for this "db-optimize" operation, but couldn't find any.
 > Actually it would be nice to know peak memory usage because..
of course, for any database (including BaseX) a common operation
is to do server sizing, to know what kind of server would be needed.
 > In this case, it seems like 2GB memory is enough to import
340k documents, weighing in at 30GB total, but it's not enough
to run "dba-optimize".
 > Is there any info about peak memory usage on [2] ? And are
there guidelines for large-scale collection imports like I'm
trying to do?
 >
 > Thanks,
 > Stefan
 >
 > [1] https://www.linuxquestions.org/
 > [2] http://docs.basex.

Re: [basex-talk] catalog.xml - xsd - urn

2019-10-21 Thread Imsieke, Gerrit, le-tex

tl;dr

– Don’t bother that the namespace is a URN.
– Don’t confuse namespaces with schema locations.
– Apparently BaseX cannot use a catalog resolver for resolving schema 
locations.
– Use other more or less portable ways for accessing the schemas, for 
ex. store them in a database or put the base file system paths into an 
external variable.
– There is no default catalog location; you specify the catalog to use 
with the CATFILE option.



Hi,

You can store an XML catalog file anywhere you like. Then you set the 
option CATFILE to this file location, or you can do it in the XQuery 
file like this:


declare option db:catfile "path/relative/to/cwd/catalog.xml";

Of course you can also supply an absolute path.

On 21.10.2019 22:05, SW-Service wrote:

Good day,
Where is the catalog.xml file stored?
I want to validate xml files against XSD, but the xsd is referenced via 
an urn.

thank you very much

Guten Tag,
Wo wird die catalog.xml Datei abgelegt?
Ich möchte xml-Dateien gegen XSD validieren, aber die XSD wird über 
einen urn referenziert.

Herzlichen Dank

xmlns:xdomea="urn:xoev-de:xdomea:schema:2.3.0">




This line only contains a namespace declaration and no schema association.

Does your document contain an xsi:schemaLocation attribute? Then this 
can be taken into account for validation, see [1].


Suppose the schema location had the same URN as the namespace, I’d 
expect a document like this:


http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="urn:xoev-de:xdomea:schema:2.3.0 
urn:xoev-de:xdomea:schema:2.3.0">



The xsi:schemaLocation attribute contains first the namespace, then the 
schema location (accidentally the same URIs). Only the latter is subject 
to catalog resolution.


Suppose you have a catalog


  


and the XSD foobar.xsd (in the same directory as the catalog):

http://www.w3.org/2001/XMLSchema";
  targetNamespace="urn:xoev-de:xdomea:schema:2.3.0">
  


Then oXygen, for example, will honor the catalog’s mapping and validate 
against foobar.xsl.


But I just found out that BaseX’s XSD validator will not use the catalog 
in order to resolve the schema location’s URI.


I think BaseX uses catalogs only for two things: When importing files 
into a database and, recently, for the XSLT processor [2].


It doesn’t seem to use it for doc(), either, so reading 
doc('urn:xoev-de:xdomea:schema:2.3.0'), which should resolve to 
foobar.xsd, doesn’t work.


This means if you use BaseX, you need to access the schema in another 
way. You can put all the XOEV schemas in a database and validate like this:


validate:xsd-report('C:/…/mydoc.xml',
db:open('xoev-schema', 'foobar.xsd'))

assuming that xoev-schema is the name of the database and foobar.xsd the 
relative path of the schema, relative to where you imported it from.


You can also refer to an actual location in the file system, with the 
base path optionally declared by an external variable, in order not to 
make it too dependent on the given directory structure.


declare namespace xs = 'http://www.w3.org/2001/XMLSchema';
declare variable $basedir-uri external := 
file:path-to-uri(Q{org.basex.util.Prop}HOMEDIR()) || 'xoev/xsd/';


validate:xsd-report('C:/cygwin/home/gerrit/XML/basex/2019-10-21_xoev/Untitled14.xml',
doc($basedir-uri || 'foobar.xsd'))

This lets users supply a value for $basedir-uri (using the $x button in 
the GUI) if they don’t have the schemas in the default location, which 
is the user’s home directory plus 'xoev/xsd/' in this example.


Please let me know where I lost you on the way.

Gerrit


[1] http://docs.basex.org/wiki/Validation_Module#XML_Schema_Validation
[2] https://github.com/BaseXdb/basex/issues/1719

--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] catalog.xml - xsd - urn

2019-10-22 Thread Imsieke, Gerrit, le-tex




On 21.10.2019 22:05, SW-Service wrote:
xmlns:xdomea="urn:xoev-de:xdomea:schema:2.3.0">


Somewhat unrelated to your initial question, and it was probably someone 
else’s idea to put a minor version number in a namespace – but this is 
considered bad practice.


All processing applications, for example XSLT stylesheets or editing 
environments, need to be adapted when the namespace changes. This can 
probably be avoided by matching only local names in XSLT, but why use 
namespaces at all when you end up ignoring them?


If a schema is likely to undergo significant changes between major 
versions, it might be acceptable to include the major version in the 
namespace. In general, it is better to use a version attribute in the 
document instead so that transformation rules, editor configurations or 
schema co-occurrence constraints can be customized to reflect specific 
differences between the versions.


Gerrit


Re: [basex-talk] How to escape/encode a search term using BaseX REST XQ

2020-01-24 Thread Imsieke, Gerrit, le-tex
While moving the URI parameter to the query string seems like an 
acceptable workaround, I, too, suggest that if *reserved* URI characters 
such as '/' appear percent-encoded, they should not be converted to 
their decoded character prior to analyzing the URI, in line with Sect. 
2.2 of RFC 3986 [1].


If I enter an escaped colon (%3A) in a path segment, it will be kept as 
%3A by BaseX, rather than converted to the reserved character ':'.


The RESTXQ specification [2] doesn’t seem to contain detailed 
instructions on how to decode the submitted URI before extracting path 
parameters, therefore I think RFC 3986 should prevail.


So I agree, BaseX should not interpret escaped slashes as if they were 
regular slashes, thereby disallowing them as part of RESTXQ path pa


Gerrit

[1] https://tools.ietf.org/html/rfc3986#section-2.2
[2] 
http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-specification.html


On 24.01.2020 13:54, Ivan Kanakarakis wrote:

Hi Christian,

thanks for the quick reply. It definitely helps, but it still keeps
this behaviour in the "weird" domain.
I do not see a reason to be decoding the URI before it gets to match a
route. What is the reason for this?

What you propose works, but if I have a route like
"/search/{$query=.+}/page/{$page}", then the query will match
everything including "/page/...". If the path was not decoded, I do
not think I would need the regex, neither any other special operation
on the route. It should work with "/search/{$query}/page/{$page}" and
it should return "tea%2Ftime". Why do I have to make workarounds to
try to guess how a part of the URL was encoded, when the URL I hit has
that part encoded?
I don't think it makes sense, and I don't see a use case for this.

When the framework receives the payload, it is responsible to match a route.
By matching the route, it will provide me with the binded parts of the
route that I requested.
Then, *I* am responsible to decode those parts as I see fit and handle
the request as I need.

If the framework decodes the URL before matching a route, that is a
problem to me - I do not have the control I need.
If the framework decodes the URL parts before binding the route
variables, this is fine - it saves me an operation.

While, I now refactored the endpoint handlers to work with query
params, and this is no longer a problem for me, it is a problem in
general.


Cheers,



On Mon, 20 Jan 2020 at 19:36, Christian Grün  wrote:


Hi Ivan,

A more common approach is to supply search terms as query parameters
(URL?query=...); in that case, your path won’t have new segments. If
you prefer paths, you can use a regular expression in your RESTXQ path
pattern [1]:

   "search/{$query=.+}"

In both cases, encodeURIComponent should be the appropriate function
to encode special characters.

Hope this helps,
Christian

[1] http://docs.basex.org/wiki/RESTXQ#Paths





On Mon, Jan 20, 2020 at 10:54 AM Ivan Kanakarakis
 wrote:


Hello everyone,

I am using BaseX 8.44 and the REST XQ interface (ie,
http://docs.basex.org/wiki/RESTXQ). I have an endpoint that, when
invoked with GET, it does a full text search (using "$db-nodes[text()
contains text { $term } all]"), gets the results, constructs a JSON
response and sends it back.

That's all fine and works great. However, I am not sure how I should
be doing the queries I describe bellow.

_Note: the query is initiated by a SPA javascript client, thus when I
say encode/uri-escape, what I mean is that I invoke the
encodeURIComponent function
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent).
_Note 2: for the sake of conversation let's consider the example
endpoint declared as:

 %rest:GET
 %rest:path("/search/{$term}")


1. I want to search for "tea". That is the basic query. A single term,
no problem.

 curl -s "https://example.com/search/tea";


2. I want to search for "tea time". Now, this query has a space in
between the two words. What I expect to get back, is any node that
contains both words (thus I have used "contains text" with "all"),
even if they may be a few words apart.
- Should I be sending an encoded/uri-escape version of this, ie, "tea%20time"?
- Or, should I be replacing the space with "+", ie "tea+time"?
- Or, some other advice?

 curl -s "https://example.com/search/tea%20time";
 curl -s "https://example.com/search/tea+time";


3. I want to search for "tea/time". This is even trickier. What I
expect to get back, is any node that contains "tea/time", ie a search
result for a single term. How do I do this?
- If I do not do anything, the slash is treated as part of the URL,
thus not matching a route.
- If I encoded/uri-escape this term, I get "tea%2Ftime". But, when I
invoke the endpoint I get the same as if there was a slash.
- I am not sure how I should deal with the slash. How should I
escape/encode this?

 curl -s "https://example.com/search/tea/time";
 curl -s "https://example.com

Re: [basex-talk] How to escape/encode a search term using BaseX REST XQ

2020-01-24 Thread Imsieke, Gerrit, le-tex




On 24.01.2020 14:36, Imsieke, Gerrit, le-tex wrote:
So I agree, BaseX should not interpret escaped slashes as if they were 
regular slashes, thereby disallowing them as part of RESTXQ path pa


…rameters.


Re: [basex-talk] Performance loss between version 9.2.4 and 9.3.2 when executing specific xQuery

2020-05-08 Thread Imsieke, Gerrit, le-tex
Just saying that I find it sooo interesting to learn at which places and 
for which purposes BaseX is being employed. Have a nice weekend!


On 08.05.2020 13:31, BIRKNER Michael wrote:

Hi Christian,


thank you for your answers. As you can guess the queries I sent in my 
original email are just simplified  examples.



The real XML structure is like the following (its library data in format 
"MarcXML", here you see an example: 
https://www.loc.gov/standards/marcxml/Sandburg/sandburg.xml)




… … …



Mag. Michael Birkner
AK Wien - Bibliothek
1040, Prinz Eugen Straße 20-22
T: +43 1 501 65 12455
F: +43 1 501 65 142455
M: +43 664 88957669



Re: [basex-talk] BaseX XSLT fails after returning first result

2020-05-21 Thread Imsieke, Gerrit, le-tex

Hi Tom,

The problem is most probably that your XSLT doesn’t create a *primary* 
output. It just writes something to another result-document. However, 
the interface for invoking an XSLT expects some result document. So if 
you just create a  element next to  and 
then discard it, it should just work.


Gerrit

On 21.05.2020 17:22, Furst, Thomas wrote:
I have a large XML file stored in BaseX that I need to split up into 
smaller, modular documents. I have created an XSL file to do so:


http://www.w3.org/1999/XSL/Transform";

     xmlns:xs="http://www.w3.org/2001/XMLSchema";

     exclude-result-prefixes="xs"

     version="2.0">

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     method="xml">


     

     

     

     

     systemDiffCode="{$sysDiff}">


     select="$sys"/>


     select="$subsys"/>


     select="$subsubsys"/>


     select="$assy"/>


     select="$disassy"/>


     name="disassyCodeVariant" select="$disassyv"/>


     select="$info"/>


     select="$infov"/>


     select="$itemloc"/>


     

     countryIsoCode="US"/>


     

     

     

     

     

     

 



My issue is that when using the xslt:transform() function in BaseX it 
only returns (creates) the first document. This is the XQuery I have for 
this:


let $style := doc('file:///C:/base.xsl')

    for $d in doc('file:///C:/Users/tfurst/Documents/Book1-test.xml')//title

   for $newD in //*[title]

   where $newD/title/@id eq $d/@id

     let $schema := $d/schemaName

     let $model := $d/modelic

     let $sdc := $d/sdc

     let $sys := $d/systemCode

     let $subsys := $d/subsys

     let $subsubsys := $d/subsubsys

     let $assy := $d/assy

     let $disassy := $d/disassy

     let $disassyv := $d/disassyv

     let $info := $d/infoCode

     let $infov := $d/infov

     let $itemloc := $d/itemloc

     let $tname := $d/tname

     let $iname := $d/iname

     return xslt:transform($newD,$style, map 
{"outputDir":"file:///G:/LMA-Conv/Flight/test-conv-out", "model":$model, 
"sysDiff":$sdc, "sys":$sys, "subsys":$subsys, "subsubsys":$subsubsys, 
"assy":$assy, "disassy":$disassy, "disassyv":$disassyv, "info":$info, 
"infov":$infov, "itemloc":$itemloc, "tname":$tname, "iname":$iname})


The document named Book1-test.xml is essentially a map of existing IDs 
of elements to new output file names. After it creates the first XML 
output file BaseX returns ERROR [FODC0002] "" (Line 1): Premature end of 
file. When I looked up the error code in the BaseX documentation this 
error is defined as *"The specified document resource cannot be 
retrieved. "*. Is there some limitation to the use of the xslt:transform 
function in a loop? I am not understanding why it was able to retrieved 
the first time, but not after that. I have tried to move the XSL to 
different file locations, no luck. Am I missing something ridiculously 
obvious here? This XSL stylesheet is a very simplified version of what 
it will ultimately become, I wanted to get the process down before fully 
developing the XSL.


Thank you,

Tom Furst



Re: [basex-talk] BaseX XSLT fails after returning first result

2020-05-21 Thread Imsieke, Gerrit, le-tex
Alternatively, apply your stylesheet using xslt:transform-text() instead 
of xslt:transform().


On 21.05.2020 18:33, Imsieke, Gerrit, le-tex wrote:

Hi Tom,

The problem is most probably that your XSLT doesn’t create a *primary* 
output. It just writes something to another result-document. However, 
the interface for invoking an XSLT expects some result document. So if 
you just create a  element next to  and 
then discard it, it should just work.


Gerrit



[basex-talk] Autocomplete with RESTXQ

2020-06-25 Thread Imsieke, Gerrit, le-tex

Hi List,

Can anyone recommend a lightweight vanilla Javascript autocomplete 
library that can easily be used together with BaseX RESTXQ? Maybe even a 
readily cloneable/modifiable example?
I don’t have a preference for a server response format. The RESTXQ 
service may be configured to return XML, JSON, or HTML
No CORS restrictions need to be considered, the query host is the same 
that delivers the HTML pages.


Gerrit


Re: [basex-talk] Autocomplete with RESTXQ

2020-06-27 Thread Imsieke, Gerrit, le-tex

Thanks Michael!

This looks quite simple but you probably saved me two to four hours of 
figuring out which lib to use, how to invoke the completion and how to 
shape the server response. Will try to use it in my app tomorrow.


And since there has been a question on this list recently which sites 
are built on BaseX, I will add to the list the site that I’m currently 
working on (Hogrefe Publishing’s Clinical Handbook of Psychotropic 
Drugs) probably in September, when it will have been relaunched. 
Accessing the site requires a subscription though, but maybe the 
publisher will decide that at least the search be free, enticing more 
mental health practitioners into subscribing when they want to access 
the search results…


Gerrit

On 26.06.2020 16:34, Michael Seiferle wrote:

Hi Gerrit,

I came up with the following example — 
https://git.basex.io/basex-public/mailinglist-autocomplete

Hope this helps — feel free to ask for more. I simply chose the first autocomplete 
library that showed up when asking google for  "autocomplete lightweight“ ;-)

Probably the most relevant changes compared to the default BaseX Config files 
are here:

Changed the Servlet mapping, so RESTXQ is output at `/api` (and not /)

https://git.basex.io/basex-public/mailinglist-autocomplete/-/blob/main/webapp/WEB-INF/web.xml#L83


And static-files are output at: `/` instead of the default `/static`

https://git.basex.io/basex-public/mailinglist-autocomplete/-/blob/main/webapp/WEB-INF/web.xml#L140



If you simply clone my repo, the relevant parts should be „correct“ — according 
to my personal taste ;-)

Feel free to ask for more help.

Michael


Am 25.06.2020 um 18:31 schrieb Imsieke, Gerrit, le-tex 
:

Hi List,

Can anyone recommend a lightweight vanilla Javascript autocomplete library that 
can easily be used together with BaseX RESTXQ? Maybe even a readily 
cloneable/modifiable example?
I don’t have a preference for a server response format. The RESTXQ service may 
be configured to return XML, JSON, or HTML
No CORS restrictions need to be considered, the query host is the same that 
delivers the HTML pages.

Gerrit




--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] xslt:transform function not working with XML Catalog

2020-07-08 Thread Imsieke, Gerrit, le-tex

Hi Vincent,

I feel your pain. Maybe this comment helps: 
https://github.com/BaseXdb/basex/issues/1793#issuecomment-579134499 
(omit the quotes in the pragma).


I documented it here, too: 
https://docs.basex.org/wiki/Catalog_Resolver#Additional_Notes
“The catalog location in the pragma can be given relative to the current 
working directory (the directory that is returned by file:current-dir()) 
or as an absolute operating system path. The catalog location in the 
pragma is not an XQuery expression; no concatenation or other operations 
may occur in the pragma, and the location string must not be surrounded 
by quotes.”


Gerrit

On 09.07.2020 06:32, Lizzi, Vincent wrote:

Hi Liam,

Thanks for the reply and suggestions. Based on your suggestion I tried 
pragmas and strace, and had another go at CatalogManager.properties, but 
they’ve not had any effect. (I’m using Windows 10 but was able to run 
strace in Ubuntu via WSL). This query:


try {

   (# db:catfile 'schemas/catalog.xml' #)

   (# db:intparse false #)

   (# db:dtd true #)

   (# db:chop false #)

   { xslt:transform('file.xml’, 'stylesheet.xsl')//inlinegraphic }

} catch * { $err:description }

Produces the same error again due to the DTD not being available at the 
system literal URI.


I did try setting verbosity 99 in a CatalogManager.properties file on 
the classpath, but this did not produce any additional messages. I also 
tried setting the same properties directly when launching BaseX this did 
not work either. Specifically, I set the following system properties 
when launching BaseX, and then used proc:property() in a query to 
confirm that these system properties were in fact set.


'xml.catalog.verbosity': '99'

'xml.catalog.ignoreMissing': 'no'

'xml.catalog.catalog-class-name': 'org.apache.xml.resolver.Resolver'

'xml.catalog.files': 'schemas/catalog.xml'

xml-resolver-1.2.jar and Saxon are definitely on the classpath.

Thanks,

VIncent

_

*Vincent M. Lizzi*

Head of Information Standards | Taylor & Francis Group

vincent.li...@taylorandfrancis.com 




Information Classification: General

*From:* Liam R. E. Quin 
*Sent:* Wednesday, July 8, 2020 10:28 PM
*To:* Lizzi, Vincent ; BaseX 

*Subject:* Re: [basex-talk] xslt:transform function not working with XML 
Catalog


On Wed, 2020-07-08 at 22:46 +, Lizzi, Vincent wrote:
 > I've encountered a problem using xslt:transform in to transform some
 > old XML that contains a DTD DOCTYPE system literal pointing to a non-
 > working URI and also uses ENTITYREF attributes to refer to image
 > files. I have the XML Catalog configured correctly using CATFILE.


If this is on Linux, using strace can help check which catalog file is
being used; you can also turn on debugging in a
CatalogManager.properties file containing the line
verbosity = 999
(thee file needs to be in your Java classpath).

There's also a BaseX pragma, (# db:catfile path/to/catalog.xml #) {
transform(...)
}

You need to turn off the BaseX internal parser.

Make sure that the resolver library and of course saxon are in your
class path.

You may need to add,
declare option db:catfile "path/relative/to/cwd/catalog.xml";
to your query.

Liam

--
Liam Quin, https://www.delightfulcomputing.com/ 


Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] xslt:transform function not working with XML Catalog

2020-07-09 Thread Imsieke, Gerrit, le-tex

Is the catalog schemas/catalog.xml residing in file:current-dir()?

On 09.07.2020 16:02, Lizzi, Vincent wrote:

Hi Gerrit,

Thank you for the hint! Removing quotes from the pragma did not work in 
this case.


   (# db:catfile schemas/catalog.xml #)

The catalog file is also configured at the beginning of the query:

declare option db:catfile 'schemas/catalog.xml';

This detail about not needing quotes in a pragma is worth remembering 
though!.


Vincent



Re: [basex-talk] xslt:transform function not working with XML Catalog

2020-07-09 Thread Imsieke, Gerrit, le-tex

Hi Vincent,

can you show us your catalog?

Since you mention that it chokes on finding the DTD, it might be that 
you need rewriteSystem instead of rewriteURI for the DTD locations.


Also if you don't resolve by public ID and refer to the DTD by relative 
path, this path will be made absolute before being catalog-resolved, so 
instead of  your can use  in order to only match 
the tail of the path.


On the other hand, since you say it’s running with standalone Saxon, the 
same DTD resolution issues should be expected there.


It may well be the case that our efforts to make DTD resolution 
available to xslt:transform() only focused on supporting xsl:import and 
xsl:include while not passing the resolver to the doc() function.


Maybe Liam can investigate this in more depth. I then suggest to ask for 
a budget at Taylor & Francis. We paid Liam to explore and enable the use 
of catalogs for xsl:import and xsl:include, and he dug through the mess 
of different interfaces etc. successfully for this limited but important 
use case. So he is *the* expert in this field and I’d like to warmly 
recommend paying him so that he can explore and fix the issue.


Gerrit

On 10.07.2020 07:55, Lizzi, Vincent wrote:

Hi Liam,

Thanks for the helpful suggestions. After trying everything you 
suggested and then also trying a few of Saxon’s configuration options, 
unfortunately I’m still having the same problem. Trying a shell script 
that contains the following:


MAIN="$( cd -P "$(dirname "$FILE")/../basex" && pwd )"

CP=$MAIN/BaseX.jar:$MAIN/lib/custom/*:$MAIN/lib/*:$CLASSPATH

echo 1 Saxon

java -cp "$CP" net.sf.saxon.Transform -s:input1.xml -xsl:transform.xsl 
-catalog:schemas/catalog.xml


echo 2 BaseX transform

java -cp "$CP" org.basex.BaseX -q"(# db:catfile schemas/catalog.xml #) 
(# db:intparse false #) (# db:dtd true #) (# db:chop false #) { 
xslt:transform('input1.xml', 'transform.xsl') }"


echo 3 BaseX transform with Saxon features configured

java 
-Dhttp://saxon.sf.net/feature/entityResolverClass=org.apache.xml.resolver.tools.CatalogResolver 
-Dhttp://saxon.sf.net/feature/uriResolverClass=org.apache.xml.resolver.tools.CatalogResolver 
-cp "$CP" org.basex.BaseX -q"(# db:catfile schemas/catalog.xml #) (# 
db:intparse false #) (# db:dtd true #) (# db:chop false #) { 
xslt:transform('input1.xml', 'transform.xsl') }"


echo 4 BaseX doc to show XML Catalog is configured correctly to parse XML

java -cp "$CP" org.basex.BaseX -q"(# db:catfile schemas/catalog.xml #) 
(# db:intparse false #) (# db:dtd true #) (# db:chop false #) { 
doc('input1.xml') }"


The classpath includes BaseX 9.3.3, Saxon HE 9.9, xml-resolver-1.2.jar, 
and CatalogManager.properties


 1. The transformation works in Saxon and uses the catalog file to
locate the DTD when parsing the XML input1.xml.
 2. The BaseX xslt:transform should work the same as #1, but fails
because the DTD cannot be read
 3. Adding Saxon configuration for Entity Resolver Class and URI Resolve
Class did not help
 4. Simply parsing the XML using doc() in BaseX with the same
configuration shows that the XML catalog is configured correctly
within BaseX

Using strace -f, the log shows that BaseX xslt:transform is reading the 
catalog.xml file from disk, and then is trying (and failing) to read the 
DTD from the non-working URIL.


This might be a bug in xslt:transform, so the workaround of using a 
regular expression replace on the DOCTYPE system URI is probably the 
practical solution.


Many thanks,

Vincent

_

*Vincent M. Lizzi*

Head of Information Standards | Taylor & Francis Group

vincent.li...@taylorandfrancis.com 



Information Classification: General

*From:* Liam R. E. Quin 
*Sent:* Thursday, July 9, 2020 12:55 PM
*To:* Lizzi, Vincent ; BaseX 

*Subject:* Re: [basex-talk] xslt:transform function not working with XML 
Catalog


On Thu, 2020-07-09 at 04:32 +, Lizzi, Vincent wrote:
 > Hi Liam,
 >
 > Thanks for the reply and suggestions. Based on your suggestion I
 > tried pragmas and strace, and had another go at
 > CatalogManager.properties, but they've not had any effect.

use, strace -f java >& hugelogfile.txt
and after, grep -i catalogmanager.properties hugelogfile.txt
and you should see where it's looking. If it doesn't look for that
file, check to see if it opened the jar file containing the resolver.

If you're running BaseX from Oxygen, Oxygen needs to have it in its
classpath too i think.

Also, of course, see if the catalog file is actually being opened!

I actually wrote some of the code in BaseX that makes XML catalogs work
with transform(), or provided a rough draft that Christian improved :),
and debugging it was... interesting.

I'd also try an absolute path for the catalog file - if you are using
the BaseX server, relative paths will be relative to the directory
(folder) where the server itself is running. (and of course the server
needs 

Re: [basex-talk] xslt:transform function not working with XML Catalog

2020-07-10 Thread Imsieke, Gerrit, le-tex

On 10.07.2020 08:23, Imsieke, Gerrit, le-tex wrote:
It may well be the case that our efforts to make DTD resolution 
available to xslt:transform() only focused on supporting xsl:import and 
xsl:include while not passing the resolver to the doc() function.


s/DTD resolution/catalog resolution/


Re: [basex-talk] Autocomplete with RESTXQ

2020-08-31 Thread Imsieke, Gerrit, le-tex

Hi Michael,

Just to let you know that I finally and successfully used the full text 
index for autocompletion, based on your prototype code.


My endpoint for the lookup is like this:

declare
%rest:path("/chpd/{$work}/complete/{$what}")
%rest:single (: only run 1 query per client :)
%output:method("json")
%rest:GET function chpd:complete($work, $what) {
  element json {
attribute type {"array"},
let $tokens := ft:tokens('CHPD_' || $work || 
'_hobots_FT')[starts-with(., $what)]

return
  for $t in $tokens
  let $c := number($t/@count)
  order by $c descending
  count $rank
  where $rank le 10
  return element _ {
attribute type {"object"},
element label {string($t)},
element value {string($t)}
  }
  }
};

As I previously wrote, the site will (re-)launch later in September, and 
I will post a link then. Although it is behind a paywall, I will look 
into making the full text search and navigation lists available publicly 
in order to lure people into subscriptions.


The full text search is satisfyingly fast, at least when I’m the only 
user on the server.


Most other pages will be cached as HTML (with some placeholders for 
login/logout & user name) by the access control application, written in 
Ruby on Rails. This is because I render them dynamically from BITS with 
Saxon, and although the rendering is fast, it would be a waste of 
resources and a worse user experience if each page serving took 
additional ~ 200 ms of XSLT rendering time.


Among other reasons, I do render them dynamically (instead of serving 
statically rendered HTML) because there is a drug comparison 
functionality that takes 2 or more drug description pages (CHPD = 
Clinical Handbook of Psychotropic Drugs) and presents a side-by-side 
diff. The possible drug combinations for diffing are to manifold to 
pre-render them as HTML. Diffing the HTML instead of the BITS XML was 
not an option due to accidental changes in the output (the document 
structure of the BITS sources are more stable than the HTML output). 
Since all other pages use the same rendering XSLT as the comparison 
pages, I thought it would be too complicated to serve specific pages as 
pre-rendered HTML while dynamically rendering other pages. Therefore 
this HTML rendering happens dynamically, and it is cached also for the 
comparison pages.


Some more details: The BITS→HTML rendering is powered by our jats2html 
library 
(https://github.com/transpect/jats2html/blob/master/xsl/jats2html.xsl). 
In the XSLT you see imports like href="http://transpect.io/xslt-util/lengths/xsl/lengths.xsl"/>. These 
URIs don’t resolve immediately. They need a catalog resolver in order to 
resolve to local resources. A shoutout to Liam Quin (and to Christian) 
for making catalog resolution available to xsl:import and xsl:include, 
https://github.com/BaseXdb/basex/issues/1719, which has been quite a 
hairy issue.


If there is an XML Prague next year and if it features a BaseX user 
meeting (nudge nudge), I will be happy to present the application in 
greater detail.


Gerrit


On 28.06.2020 22:56, Michael Seiferle wrote:

You’re welcome.
Glad I could help save some time, I agree it looks simple, yet wrapping ones 
head around those small details can be a real showstopper sometimes :-)
Feel free to ask for more details anytime.

Looking forward to seeing said search portal!


Best from Konstanz
Michael
Von meinem iPhone gesendet


Am 27.06.2020 um 14:13 schrieb Imsieke, Gerrit, le-tex 
:

This looks quite simple but you probably saved me two to four hours of figuring 
out which lib to use, how to invoke the completion and how to shape the server 
response. Will try to use it in my app tomorrow.




Re: [basex-talk] Paging results of an XQuery-Search

2020-09-26 Thread Imsieke, Gerrit, le-tex
If you provide the search RESTXQ endpoint also (or only) for GET 
requests, you can easily create links for results 51–100, etc.


Invoking search and passing all parameters per GET is better anyway, 
since people can bookmark the search query.


I was hesitant initially to run the same query over and over again, only 
to pick a different slice of the results. But if there is a full text 
index and if it is used, this has been ultra fast for my use cases so far.


Gerrit

On 26.09.2020 16:55, Günter Dunz-Wolff wrote:

Hi Christian, hi all

thank you for your advice. I took the approach from Christian and it’s working. 
I’m using it with query-params (form-params) with RESTXQ. But it only works for 
the very first fifty hits. I have no idea, how to implement the functionality 
to serve the next 50 hits and so on. Is it possible to run the same query with 
new $start and $max params without using the searchform again? Any further help 
appreciated. Thanks in advance.

Best regards,
Günter


Am 25.09.2020 um 20:13 schrieb Christian Grün :

Hi Günter,

Here’s one way to do it:

declare variable $QUERY external := 'mailto';
declare variable $START external := 1;
declare variable $MAX external := 50;

let $hits := db:open('data')//text()
  [. contains text { $QUERY }]
let $count := count($hits)
return {
  { concat($count, ' results, showing ', $START, ' – ',
min(($count, $START + $MAX - 1)), ':') },
  {
for $hit in subsequence($hits, $START, $MAX)
return { $hit }
  }
}

As Omar has already indicated, you can e.g. use fn:subsequence to
limit the size of a result sequence. I have defined some external
variables, which you can assign before running your query. If you use
RESTXQ, you can supply them with query parameters.

Hope this helps,
Christian


On Fri, Sep 25, 2020 at 1:23 PM Günter Dunz-Wolff
 wrote:


Hi all,
is it possible to present the results of an XQuery search in parts of 50? In 
order to speed up the search, only the first 50 results should be displayed and 
only if the user is interested in further results, 50 new results each should 
be displayed. Is this even possible? I did not find anything about it in the 
documentation.

Example:
let $collection := collection("data")
let $hits := $collection//*:s[.//text() contains text {$query_string}]
let $count_hits := count($hits)
return

{
if $count_hits <= 50 then

{for $hit in $hits
return
{$hit}

else
???
}


Thanks for any advice.
Best regards
Guenter








Re: [basex-talk] grouping by fuzzy match?

2020-11-11 Thread Imsieke, Gerrit, le-tex
This is probably difficult since in BaseX, fuzzy matching is implemented 
using the Levenshtein distance between two strings [1]. Therefore 
similarity is a relation between pairs of paragraphs rather than an 
intrinsic property of an individual paragraph.


You should look for content fingerprinting/clustering techniques.

[1] https://docs.basex.org/wiki/Full-Text#Fuzzy_Querying


On 12.11.2020 00:00, Graydon Saunders wrote:

Hello --

Is there some way to assign the abstraction of a fuzzy match to a 
variable, so that something like


for $x in //p
   let $key := get-fuzzy-match-value($x)
   group by $key
   return {$x}

would be possible?

I'm supposing this is one of those things that's either easy or impossible.

Thanks!
Graydon




Re: [basex-talk] grouping by fuzzy match?

2020-11-11 Thread Imsieke, Gerrit, le-tex
Maybe OpenRefine and particularly its clustering feature [1] can be 
useful. I don't have any first-hand experience with it though.


[1] https://github.com/OpenRefine/OpenRefine/wiki/Clustering-In-Depth

On 12.11.2020 00:57, Graydon Saunders wrote:

Useful keywords; thank you!

Also more of a development effort than this project will support, alas.  
(Unless someone's willing to provide a pointer to their public release 
of such a solution, free for commercial use?  Which doesn't seem a whole 
lot more likely than someone throwing a gold brick through my window.)


On Wed, Nov 11, 2020 at 6:42 PM Imsieke, Gerrit, le-tex 
mailto:gerrit.imsi...@le-tex.de>> wrote:


This is probably difficult since in BaseX, fuzzy matching is
implemented
using the Levenshtein distance between two strings [1]. Therefore
similarity is a relation between pairs of paragraphs rather than an
intrinsic property of an individual paragraph.

You should look for content fingerprinting/clustering techniques.

[1] https://docs.basex.org/wiki/Full-Text#Fuzzy_Querying


On 12.11.2020 00:00, Graydon Saunders wrote:
 > Hello --
 >
 > Is there some way to assign the abstraction of a fuzzy match to a
 > variable, so that something like
 >
 > for $x in //p
 >    let $key := get-fuzzy-match-value($x)
 >    group by $key
 >    return {$x}
 >
 > would be possible?
 >
 > I'm supposing this is one of those things that's either easy or
impossible.
 >
 > Thanks!
 > Graydon





Re: [basex-talk] Call for install/setup stories from users

2021-03-17 Thread Imsieke, Gerrit, le-tex
Just like you, I usually download the Zip package on Windows and Linux. 
Then I put a Saxon Jar and maybe a Saxon license file in the lib/custom 
directory and adjust Xmx in the startup scripts for the given platform.


So I don’t use package managers for BaseX.

For some projects, I add BaseX and Saxon to the project’s (svn) code 
repo. I populate the webapp directory with project-specific code.
If a new BaseX release arrives, I unzip it over the existing files, 
inspect the changes to the scripts in bin/ and to 
webapp/WEB-INF/web.xml, reverting the changes to these files most of the 
time so that my project-specific changes are preserved.
I don’t do this for each and every new release. One project that I’m 
working on is still on 9.3.2 beta.


Another (public) repo version that I use as an XSLT service when 
deployed (instead of a Saxon servlet) currently runs 9.4.6: 
https://subversion.le-tex.de/common/basex
It is bundled with Saxon PE 10.3 (not with a license file though), with 
a sample XSLT that transforms factbook.xml 
(https://subversion.le-tex.de/common/basex/etc/factbook.xsl) and with 
additional documentation 
(https://subversion.le-tex.de/common/basex/readme_modifications.txt)


Gerrit


On 17.03.2021 20:05, Bridger Dyson-Smith wrote:

Hi all -

Per the recent thread about installing, I was hoping to convince some of 
you to share your experiences installing and running BaseX. Whether you 
use Mac OS, Windows, a Linux, or something else: how are you installing 
and running BaseX?


I'm asking as there could be some possible improvements to the wiki that 
might help new users (or even less-new users!) get up and running.


Thanks in advance for your time and trouble! If I can hear about number 
of approaches, I'm happy to attempt writing up some details for the wiki.

Best,
Bridger

PS Here's mine:

Operating systems: I'm typically using BaseX on either a FreeBSD or a 
Void Linux system (rarely on other Linuxes, and only once or twice on 
Windows).


Install process: my OS' don't have a pre-packaged download for BaseX, so 
I do something like:

1. cd ~/bin
2. mkdir basex-src basex-data
3. fetch|wget https://files.basex.org/releases/BaseX.zip 


4. unzip BaseX.zip
5. rm -rf basex/src basex/data
6. ln -s ~/bin/basex-src ~/bin/basex/src; ln -s ~/bin/basex-data 
~/bin/basex/data

...
7. enjoy basex!

Upgrade process: something like
1. cd ~/bin
2. fetch|wget https://files.basex.org/releases/BaseX.zip 


3. mv basex basex-old
4. unzip BaseX.zip
5. rm -rf basex/src basex/data
6. ln -s ~/bin/basex-src ~/bin/basex/src; ln -s ~/bin/basex-data 
~/bin/basex/data

...

Usage note: I have a line in my shell RC file (~/.zshrc) that helps my 
shell/command line know where to find the various basex executables:

`export PATH="$PATH:$HOME/bin/basex/bin"`







Re: [basex-talk] Question about JSON parsing/serializing

2021-03-20 Thread Imsieke, Gerrit, le-tex

Hi Hans-Jürgen,

Maybe this thread and the linked sources can shed some light on the 
annoying slash escaping:


https://www.mhonarc.org/archive/html/xsl-list/2019-10/msg00078.html

Gerrit

On 20.03.2021 11:11, Hans-Juergen Rennau wrote:

Dear BaseX team,

there is something I don't understand about the parsing/serializing of JSON.

When I serialize a document without options, backslashes are escaped. So 
for example ...


https://help.openconnectors.ext.hana.ondemand.com/home/google-analytics
   becomes
"url":"https:\/\/help.openconnectors.ext.hana.ondemand.com\/home\/google-analytics"

Only using serialization options - map{"escape": "no"} - do I get the 
output as expected, corresponding to the input.


Why are slashes by default escaped when serializing JSON?

Kind regards,
Hans-Jürgen

PS: When parsing, the slashes are not escaped, so it is "asymmetrical" - 
I need to parse without options, yet to serialize with options.




Re: [basex-talk] Question about JSON parsing/serializing

2021-03-22 Thread Imsieke, Gerrit, le-tex
What’s wrong with adding 'use-character-maps': map{'/': '/'} to the JSON 
serialization each time?


On 22.03.2021 08:05, Hans-Juergen Rennau wrote:
Good Morning, Liam, thank you very much for this precise link into the 
video, showing the "why" behind escaping slashes.


In spite of the incorrect "must escape", your previous post was key to 
me for understanding my error. It is absolutely crucial to understand 
that within the JSON model, "/" and "\/" denote the same Unicode point. 
Therefore my talking about expected roundtripping behavior was simply 
wrong: you cannot expect, or achieve, roundtripping when there are 
alternative representations, as the choice of representation cannot be 
remembered. (Comparable with the choice of single or double quotes to 
delimit attribute values in XML.)


 >>> NEW VERSION OF THE ORIGINAL "COMPLAINT" <<<

So now it seems to me that everything boils down to one REAL ISSUE, and 
one might look at it either as a bug or as a missing feature:


Currently, it is not possible to serialize JSON in unescaped form which 
is guaranteed to be *valid* JSON. The problem is that serialization 
option "escape" turns off ALL backslash escaping - not only the optional 
(like /) but also the mandatory ones: double quote and backslash. This 
means that the serialization option escape="no" may produce invalid 
JSON, and I regard this as a bug: only the optional escaping should be 
switched off.


If one disagrees and thinks it makes sense to offer a serialization 
which is potentially invalid JSON (difficult to imagine, though), then I 
regard the current situation as having a gap: we then need a further 
option switching off /optional/ serialization, but retaining mandatory 
escaping, in order to preserve valid JSON and safeguard unchanged 
information content.


SUMMING UP: can we have a possibility to serialize JSON with guarantee 
of correctness and without optional backslash escapes? Proposal: change 
the behavior of serialization option "escape=no", so that mandatory 
escaping is retained; alternative: add a further serialization option 
restricting backslash escaping to the mandatory cases.


Kind regards,
Hans-Jürgen

PS: Default parser behaviour is perfect, as it is: every JSON character 
is represented by the same Unicode character, e.g. \" becomes ", \/ 
becomes /, \n becomes 
.


Am Sonntag, 21. März 2021, 19:25:25 MEZ hat Liam R. E. Quin 
 Folgendes geschrieben:



On Sun, 2021-03-21 at 18:06 +, Hans-Juergen Rennau wrote:
 >  No, Liam, that is a misunderstanding - it *may* be escaped by a
 > preceding \,

oops, thanks! Altough i shuld note that it's sort of changed over time
from recommended to "may" - but see e.g. for the rationale (Doug
Crockford explains it in the first few second after the 6  minute point
so that's where i've linked to):

https://www.youtube.com/watch?v=-C-JoyNuQJs&t=386s 



It's so that  doesn't occur.



Re: [basex-talk] [EXTERNAL] Re: Using other Java runtimes?

2021-04-17 Thread Imsieke, Gerrit, le-tex
Glad that it works so far. I have just one caveat for OpenJDK 11: If you 
supply an absolute Windows path with forward slashes (such as 
C:/foo/bar) as part of the classpath, Java will try to make it absolute 
wrt the current working directory, resulting in something like
java.nio.file.InvalidPathException: Illegal char <:> at index 49: 
c:\cygwin\home\gerrit\myproject\c:\foo\bar
At least this is what we experienced with an XProc pipeline (XML 
Calabash and Saxon 9.8) about a year ago, when a customer tried to run 
it on OpenJDK 11.
The issue doesn’t occur with Java versions 7, 8, 9, 13, or 15 (others 
not tested). Therefore I recommend not to use Java 11 on Windows. Use a 
more recent version, at least 13, instead.


Gerrit

On 17.04.2021 20:15, Peter Villadsen wrote:

I have installed OpenJDK on one machine so far, and it seems to work well on 
windows. Thanks to those who helped make these suggestions.

Best Regards

Peter Villadsen

-Original Message-
From: Graydon 
Sent: Friday, April 16, 2021 11:20 PM
To: Peter Villadsen 
Cc: BaseX 
Subject: [EXTERNAL] Re: [basex-talk] Using other Java runtimes?

On Fri, Apr 16, 2021 at 09:39:46PM +, Peter Villadsen scripsit:

I was wondering what the options are for running BaseX on top of a runtime that 
is different from the Oracle one? I see Oracle is aggressively monetizing the 
Java runtime, but I know there are alternatives out there. Have any been tested 
with BaseX?


I can't talk about _tested_, but I've been using BaseX on Fedora for a decade 
now, and it's been fine as Fedora shifted to OpenJDK pacakages to provide Java. 
 Current happens to be openjdk 11.0.10 2021-01-19.

I'm also not running any server anything; this is pretty strictly command line 
or gui with not that much data (at most single-digit GB) and not-that-complex 
queries, so this isn't a comprehensive thing, but for at least those purposes I 
can say BaseX works fine on the OpenJDK.

--
Graydon Saunders  | graydon...@gmail.com Þæs oferéode, ðisses swá mæg.
-- Deor  ("That passed, so may this.")





[basex-talk] Can the full text tokenizer be instructed not to tokenize at hyphens?

2021-07-12 Thread Imsieke, Gerrit, le-tex
A customer wants to include composite terms such as 'third-generation' 
as single tokens so that they may be offered in a completion list. I 
don’t think this is configurable, or is it?


Gerrit


Re: [basex-talk] Can the full text tokenizer be instructed not to tokenize at hyphens?

2021-07-12 Thread Imsieke, Gerrit, le-tex

That’s a feasible workaround, thank you.

On 13.07.2021 08:27, Christian Grün wrote:

Hi Gerrit,

I’m sorry there’s currently no way to adjust that. We’d probably think
of how this goes hand in hand with other XQFT features that rely on
single-word tokens (such as stemming).

For now, a little extra index could be generated instead, which
contains all terms the that are supposed to occur in the completion
list.

Cheers,
Christian


On Tue, Jul 13, 2021 at 7:28 AM Imsieke, Gerrit, le-tex
 wrote:


A customer wants to include composite terms such as 'third-generation'
as single tokens so that they may be offered in a completion list. I
don’t think this is configurable, or is it?

Gerrit


Re: [basex-talk] Autocomplete with RESTXQ

2021-07-18 Thread Imsieke, Gerrit, le-tex

Update:

The site didn’t relaunch in September 2020, it relaunched this Thursday.

I needed to wrap $what (below) in ft:normalize as per Christian’s 
suggestion, so that upper-case input will be matched against the 
normalized, lower-case, index.


The publisher didn’t yet agree to make the search result pages publicly 
accessible. However, there’s a 14-day test access available at 
https://www.hogrefe.com/eu/free-trial-access


I don’t mean to brag, but this is a very nice example of what you can do 
with BaseX (and Saxon, and XML, and RDF).


Gerrit




On 31.08.2020 10:26, Imsieke, Gerrit, le-tex wrote:

Hi Michael,

Just to let you know that I finally and successfully used the full text 
index for autocompletion, based on your prototype code.


My endpoint for the lookup is like this:

declare
     %rest:path("/chpd/{$work}/complete/{$what}")
     %rest:single (: only run 1 query per client :)
     %output:method("json")
     %rest:GET function chpd:complete($work, $what) {
   element json {
     attribute type {"array"},
     let $tokens := ft:tokens('CHPD_' || $work || 
'_hobots_FT')[starts-with(., $what)]

     return
   for $t in $tokens
   let $c := number($t/@count)
   order by $c descending
   count $rank
   where $rank le 10
   return element _ {
     attribute type {"object"},
     element label {string($t)},
     element value {string($t)}
   }
   }
};

As I previously wrote, the site will (re-)launch later in September, and 
I will post a link then. Although it is behind a paywall, I will look 
into making the full text search and navigation lists available publicly 
in order to lure people into subscriptions.


The full text search is satisfyingly fast, at least when I’m the only 
user on the server.


Most other pages will be cached as HTML (with some placeholders for 
login/logout & user name) by the access control application, written in 
Ruby on Rails. This is because I render them dynamically from BITS with 
Saxon, and although the rendering is fast, it would be a waste of 
resources and a worse user experience if each page serving took 
additional ~ 200 ms of XSLT rendering time.


Among other reasons, I do render them dynamically (instead of serving 
statically rendered HTML) because there is a drug comparison 
functionality that takes 2 or more drug description pages (CHPD = 
Clinical Handbook of Psychotropic Drugs) and presents a side-by-side 
diff. The possible drug combinations for diffing are to manifold to 
pre-render them as HTML. Diffing the HTML instead of the BITS XML was 
not an option due to accidental changes in the output (the document 
structure of the BITS sources are more stable than the HTML output). 
Since all other pages use the same rendering XSLT as the comparison 
pages, I thought it would be too complicated to serve specific pages as 
pre-rendered HTML while dynamically rendering other pages. Therefore 
this HTML rendering happens dynamically, and it is cached also for the 
comparison pages.


Some more details: The BITS→HTML rendering is powered by our jats2html 
library 
(https://github.com/transpect/jats2html/blob/master/xsl/jats2html.xsl). 
In the XSLT you see imports like href="http://transpect.io/xslt-util/lengths/xsl/lengths.xsl"/>. These 
URIs don’t resolve immediately. They need a catalog resolver in order to 
resolve to local resources. A shoutout to Liam Quin (and to Christian) 
for making catalog resolution available to xsl:import and xsl:include, 
https://github.com/BaseXdb/basex/issues/1719, which has been quite a 
hairy issue.


If there is an XML Prague next year and if it features a BaseX user 
meeting (nudge nudge), I will be happy to present the application in 
greater detail.


Gerrit


On 28.06.2020 22:56, Michael Seiferle wrote:

You’re welcome.
Glad I could help save some time, I agree it looks simple, yet 
wrapping ones head around those small details can be a real 
showstopper sometimes :-)

Feel free to ask for more details anytime.

Looking forward to seeing said search portal!


Best from Konstanz
Michael
Von meinem iPhone gesendet

Am 27.06.2020 um 14:13 schrieb Imsieke, Gerrit, le-tex 
:


This looks quite simple but you probably saved me two to four hours 
of figuring out which lib to use, how to invoke the completion and 
how to shape the server response. Will try to use it in my app tomorrow.




--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] XProc?

2021-08-12 Thread Imsieke, Gerrit, le-tex

We couple it more loosely using RESTXQ endpoints and HTTP requests.

On 12.08.2021 13:58, Jonathan Robie wrote:
What hooks does BaseX provide for XProc?  Where can I find examples of 
BaseX use in an XProc pipeline?


Jonathan


Re: [basex-talk] Can XQuery return unique values present across multiple databases?

2021-08-13 Thread Imsieke, Gerrit, le-tex

Tamara! Welcome to another proselyte in the Church of Xquery.

This church is open to people from all walks of life, for example, from 
XSLT or XForms backgrounds.


But not from PHP.

Just kidding, everyone is free to use the tools and languages they got 
accustomed to (until they are made aware of the X stack, that is).


Do more with BaseX and RESTXQ, it is quite rewarding! The community is 
nice, inclusive, and welcoming.


Gerrit

On 13.08.2021 20:50, Tamara Marnell wrote:
Thank you, Martin! I'm new to XQuery and didn't know about higher-order 
functions like fold-left. With a little tweaking, this is perfect for my 
application:


declare variable $d as xs:string external;
declare variable $f as xs:string external;
declare function local:get_eads($facet as xs:string, $db_ids as item()+) 
as item()* {

   let $split := tokenize($facet, ':')
   return db:open('facet-' || $split[1])/terms/term[@text=$split[2] and 
@db=$db_ids]/ead

};
let $db_ids := tokenize($d, '\|')
let $facets := tokenize($f, '\|')
let $eads :=
   fold-left(
     $facets,
     local:get_eads(head($facets), $db_ids),
     function($all_eads, $facet) {
       let $facet_eads := local:get_eads($facet, $db_ids)
       let $eads_in_both := distinct-values($all_eads[.=$facet_eads])
       return $eads_in_both
     }
   )
return {
   for $ead in $eads
     return {$ead}
}

On Thu, Aug 12, 2021 at 11:27 PM Martin Honnen > wrote:



Am 13.08.2021 um 00:12 schrieb Tamara Marnell:

Short question: Is it possible to write an XQuery FLWOR statement
that can return a set of unique values present across multiple
databases?

Long question: Our new website in development displays EAD finding
aids stored across 45 databases in BaseX. I've built "facet"
databases that index terms in the EADs from controlled
vocabularies like subjects, places, personal names, etc. The
indexes follow this structure, where each EAD node contains a
unique identifier:


  
    12345
    67890
  
  
    abcde
  
  {etc.}


In the search interface, users can select multiple facets to apply
to one search. For example, they could browse database 12 for EADs
with the subject "Literature" /and/ the place "Oregon," etc.

I currently use the REST server to run an XQuery file that loops
through each selected facet and prints /all/ EAD IDs for each
submitted term and database. Then after results are returned, I
use PHP to count occurences of each EAD and print them only if the
total count matches the count of facets used.

declare variable $d as xs:string external;
declare variable $f as xs:string external;
let $db_ids := tokenize($d, '\|')
return {
for $facet in tokenize($f, '\|')
  let $split := tokenize($facet, ':')
  let $facet_type := $split[1]
  let $facet_term := $split[2]
  let $facet_db := 'facet-' || $facet_type
  return {
    for $ead in db:open($facet_db)/terms/term[@text=$facet_term
and @db=$db_ids]/ead
      return $ead
  }
}

So in the hypothetical example above, I'd pass "12" as d (or
multiple selected databases separated by bars) and
"subject:Literature|geogname:Oregon" as f, and I'd get back a
document like:


  
    12345
    67890
  
  
    12345
  


The count of "12345" will equal the count of the user's selected
facets, so that result will be printed, but 67890 will not.

Is there a more efficient way to do this? I'd prefer the XQuery to
return only the EADs that meet all criteria, so only 12345 would
be returned because it's in facet-subject under Literature /and/
in facet-geogname under "Oregon," and then I don't have to do any
post-processing.



I think you can use fold-left to reduce the found eas while
selecting them:



let $db_ids := tokenize($d, '\|')
return
     {
     let $facet-maps :=
   fold-left(
     for $facet in tokenize($f, '\|')
   let $split := tokenize($facet, ':')
   let $facet_type := $split[1]
   let $facet_term := $split[2]
   let $facet_db := 'facet-' || $facet_type
     return
   map:merge(
   for $ead in
db:open($facet_db)/terms/term[@text=$facet_term and @db=$db_ids]/ead
   return map:entry(string($ead), map { 'node' :
$ead, 'type' : $facet_type, 'term' : $facet_term })
   ,
   map { 'duplicates' : 'combine' }
   )
    ,
    map{},
    function($ams, $m) {
    for $m1 in $ams
    return map:remove($m1, map:keys($m1)[not(. =
map:keys($m))]),
    $m
    }
   )
     return
     for $m 

Re: [basex-talk] Ms Excel-Files treated as MS-Word-Files

2021-10-25 Thread Imsieke, Gerrit, le-tex




On 25.10.2021 14:31, Alexander Witzigmann wrote:

Hi,

Excel files not treated as archives comparable to MS-Word / 
MS-PowerPoint or idml Files (Indesign related) while importing using 
GUI. The later 3 are treated as (zip) archives and content is added. 
This is very handy for certain data analytics tasks.

Would be nice if .xslx files treated the same as docx, pptx, etc.


This seems to be typo-related: 
https://github.com/BaseXdb/basex/blob/382c8097afb1ec5bac1e9511a2287686c33f669d/basex-core/src/main/java/org/basex/io/IO.java#L71 
(xslx → xlsx)


Re: [basex-talk] specifying the processor for xslt:transform()

2021-11-05 Thread Imsieke, Gerrit, le-tex




On 05.11.2021 03:03, Liam R. E. Quin wrote:

On Thu, 2021-11-04 at 18:43 -0400, Graydon Saunders wrote:



Related to this, setting the catalog for use by xslt:transform() is
defeating me.


The only ways i have found to debug these are
(1) with strace -f, to make sure the file is being read
(2) with a CatalogManager.properties file [[
verbosity=65535
# relative-catalogs=false
prefer = public
catalogs=mycataloguefile.xml
]]

Likely you need entries in the catalog file starting  with file:///

If you are uploading queries to a BaseX server, remember it's the
server that needs to have  had XLASSPATH set when starting, and that
relativeURIs like "catalog.xml" might be  sought for in the server's
directory.

Liam


Liam and Christian have thankfully added support for resolving 
include/import URIs and doc(…) URIs approx 2 years ago [1]. A thing that 
I recently found was lacking is resolution of system identifiers that 
occur in documents. That is, if there is a reference to a DTD in a 
document that is read during the transformation, the catalog resolution 
does not apply to the public or system identifiers.


Is this the issue that you are encountering, Graydon?

Your first argument to xslt:transform is db:open('acme_content')[1]. 
Does this document have a DOCTYPE declaration? I’d have guessed that the 
DOCTYPE declaration was stripped away when the documents were loaded 
into the DB, that is, parsing with the DTD only happened during import. 
But maybe this is different if you use the internal parser.


Gerrit

[1] https://github.com/BaseXdb/basex/issues/1719


Re: [basex-talk] Access to "https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/first.xml" blocked?

2021-11-11 Thread Imsieke, Gerrit, le-tex

Hi Ben,

What about other resources there, like:

https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/input.xml
https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/response.txt

Do they pass on Windows?

Gerrit


On 11.11.2021 16:14, Ben Engbers wrote:

Hi,

Allthough I have never had any feedback on my R-client to BaseX, I have 
steadily been working on a new version (even while being retired, I 
still like to program :-).
At present all tests are passed, except one test on adding content to a 
database.


On my Linux-machine 'url 
exists("https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/first.xml";)' 
returns TRUE and 'first.xml' is added to a database.


When executed on a Windows machine, the same test returns FALSE.
I have tested other URL's - starting with https or http - and they are 
all accepted.


Any clue why 
"https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/first.xml"; 
is blocked?


Ben




Re: [basex-talk] Access to "https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/first.xml" blocked?

2021-11-11 Thread Imsieke, Gerrit, le-tex

Maybe related to the HTTP header field x-content-type-options: nosniff

https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/gg622941(v=vs.85)?redirectedfrom=MSDN

What is the tool/library you are using on Windows? Is it an R HTTP 
client that is interfacing some Windows DLL? Maybe they put this 
rejection in the DLL.


Maybe you can find another proxying server for raw Github files?

https://stackoverflow.com/questions/40728554/resource-blocked-due-to-mime-type-mismatch-x-content-type-options-nosniff

Gerrit


On 11.11.2021 16:37, Ben Engbers wrote:
They are both rejected. I also tried with "https://www.cnn.com"; and 
"https://nos.nl";. The first is accepted, the second is rejected.


In firefox all URL's are accepted.

Ben

Op 11-11-2021 om 16:24 schreef Imsieke, Gerrit, le-tex:

Hi Ben,

What about other resources there, like:

https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/input.xml 

https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/response.txt 



Do they pass on Windows?

Gerrit


On 11.11.2021 16:14, Ben Engbers wrote:

Hi,

Allthough I have never had any feedback on my R-client to BaseX, I 
have steadily been working on a new version (even while being 
retired, I still like to program :-).
At present all tests are passed, except one test on adding content to 
a database.


On my Linux-machine 'url 
exists("https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/first.xml";)' 
returns TRUE and 'first.xml' is added to a database.


When executed on a Windows machine, the same test returns FALSE.
I have tested other URL's - starting with https or http - and they 
are all accepted.


Any clue why 
"https://raw.githubusercontent.com/BaseXdb/basex/master/basex-api/src/test/resources/first.xml"; 
is blocked?


Ben






[basex-talk] Predicate referring to following-sibling::node()[1]/self::text() incorrectly optimized

2021-12-02 Thread Imsieke, Gerrit, le-tex

Hi Christian,

I wrote a query for a customer who wants to analyze their legacy ISO 
12083 math formulas, in this case for detecting multiple subsequent 
 elements of length >= 3 with only whitespace in between.


This is a synthetic test document:


  
tan tan
  
  
sin 2 sin
  
  
cos3 cos
  


And this is the query I wrote:

let $rms := //(formula | dformula)//roman[string-length() gt 2]
 [

following-sibling::node()[1]/self::text()[not(normalize-space())]
 ]
 [

following-sibling::*[1]/self::roman[string-length() gt 2]
 ]/..,
$docs := for $rm-context in $rms
 let $path := db:path($rm-context)
 group by $path
 return {
   $rm-context
 }
return
{
  $docs
}

BaseX (up to version 9.6.3) erroneously reports all three  
elements as a result, while only the first should be reported.


This can be remedied by using parentheses, as in 
(following-sibling::node())[1]/self::text() and 
(following-sibling::*)[1]/self::roman. But this is inefficient, and the 
original query should just work™.


In the optimized original query there is 
following-sibling::text()[fn:position() = 1] and 
following-sibling::roman[fn:position() = 1]. These are  incorrect 
optimizations of following-sibling::node()[1]/self::text() and 
following-sibling::*[1]/self::roman.


Gerrit



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


[basex-talk] User group meeting in Prague?

2021-12-17 Thread Imsieke, Gerrit, le-tex

Fellow BaseX Users!

You might have heard that XML Prague 2022 will take place in June. 
(Unless the then-prevalent Greek letter makes it impossible even in that 
time of year, of course.)


I asked Christian whether the BaseX team will organize a user group 
meeting after it had not happened for years now. Christian didn’t seem 
to be very fond of organizing such a meeting. I asked him whether he 
would be available to present new features, the roadmap, and for a Q&A 
session if the users themselves organized such a meeting. He agreed, and 
therefore I hereby ask the list members whether anyone will join me in 
organizing this.


The plan looks as follows: We will apply for one or two 90-minute slots 
via the CFP process (https://www.xmlprague.cz/cfp/). We don’t need to 
have a fixed schedule yet by Dec. 20 (end of CFP date as currently 
announced – it will be extended anyway).


Christian was so kind as to create a new repo, user-group, on Github. We 
will use one or more of its Wiki pages [1] in order to plan the event. 
The page will eventually evolve into an agenda if you agree.


Looking forward to meeting many of you in Prague in June.

And another organizing volunteer (or other volunteers), please come 
forward. Maybe we can also deal with it in the Wiki [2].


Gerrit

[1] https://github.com/BaseXdb/user-group/wiki/2022-06-XML-Prague
[2] https://github.com/BaseXdb/user-group/wiki/Members


Re: [basex-talk] Response from proc:execute() for git Command Not Coming Through as Expected

2022-01-21 Thread Imsieke, Gerrit, le-tex

Hi Eliot,

Maybe the pager is getting in your way? Try the global git option 
--no-pager.


Gerrit

On 21.01.2022 20:27, Eliot Kimber wrote:

[BaseX 9.6.4 on Mac through BaseX GUI]

I’m trying to automate syncing a database with content from a git repo 
that is locally cloned.


My approach is to use proc:exec() to pull the repo and then use git 
diff-tree to see what files changed:


let $pullResult := proc:execute($gitCmd,('pull', '-v'), map{'dir' : 
$repoPath})


let $changeList := proc:execute($gitCmd, ('diff-tree', '--no-commit-id', 
'--name-status', 'HEAD'), map{'dir' : $repoPath})


However, the result returned for “diff-tree” appears to get truncated.

Here’s a typical result, where I’m echoing out the $pullResult and 
$changeList values created above:


Pull result:



   Already up to date.



   From code.devsnc.com:doc/dita-now

= [up to date]  master  -> origin/master

= [up to date]  dita-now    -> origin/dita-now

= [up to date]  rtprn   -> origin/rtprn

= [up to date]  sanfransokyo    -> origin/sanfransokyo

= [up to date]  scodefreeze -> origin/scodefreeze

= [up to date]  scratc/table_issues_fix -> 
origin/scratc/table_issues_fix


= [up to date]  scratch/fix_canvas_issue -> 
origin/scratch/fix_canvas_issue


= [up to date]  scratch/newDitavals2022 -> 
origin/scratch/newDitavals2022


= [up to date]  scratch/simplifyDitavals -> 
origin/scratch/simplifyDitavals


= [up to date]  scratch/table_name_issue -> 
origin/scratch/table_name_issue




   0



Change list:



   M   doc



   0



Note that the pull response looks as expected but the change list 
response is just “M\tdoc” where “doc” is the first directory in what 
should be a path to a file.


Here’s the same result from the command line:

dita-now % git diff-tree --no-commit-id --name-status -r HEAD

Mdoc/source/product/rpa-studio/task/use-datareader-queryexcel.dita

Mdoc/source/product/rpa-studio/task/use-datetime-add.dita

Mdoc/source/product/rpa-studio/task/use-datetime-compare.dita

…

I can’t see anything I’m doing wrong or options to the execute() or 
system() functions that would affect the result.


Any idea what might be causing this or how I could work around it?

Thanks,

Eliot



Re: [basex-talk] Managing Interactions with Long-Running Processes

2022-01-26 Thread Imsieke, Gerrit, le-tex

Hi Eliot,

Can you be a bit more specific about how you set the timeout?

If you only set it as an option on one of the proc:*() functions but the 
the action gets triggered by a RESTXQ request, then still the default 
timeout of 30 seconds may kick in 
(https://docs.basex.org/wiki/Options#TIMEOUT). See the possibilities to 
alter this value at the top of said page. For example, you can set it in 
webapp/WEB-INF/web.xml or with -Dorg.basex.TIMEOUT=7200 in your BaseX 
startup script.


Gerrit


On 26.01.2022 22:33, Eliot Kimber wrote:
I’m making good progress on our BaseX-based validation dashboard 
application.


The basic process here is we use Oxygen’s scripting support to do DITA 
map validation and then ingest the result into a database (along with 
the content documents that were validated) and provide reports on the 
validation result.


The practical challenge here seems to be running the Oxygen process 
successfully from BaseX—because our content is so huge it can take 10s 
of minutes for the Oxygen process to run.


I set the command time-out to be much longer than the process should run 
but running it from the HTTP app’s query panel it eventually failed with 
an error that wasn’t a time out (my code had earlier reported legit 
errors so I know errors will be properly reported).


As soon as the Oxygen process ends I want to ingest the resulting XML 
file, which is why I started with doing it from within BaseX.


But I’m wondering if this is a bad idea and I should really be doing it 
with i.e., a shell script run via cron or some such?


I was trying to keep everything in BaseX as much as possible just to 
keep it simple.


Any general tips or cautions for this time of integration of BaseX with 
the outside world?


Thanks,

E.

_

*Eliot Kimber*

Sr Staff Content Engineer

O: 512 554 9368

M: 512 554 9368

servicenow.com 

LinkedIn  | Twitter 
 | YouTube 
 | Facebook 





--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] Issue with HTTP client and authentication

2022-02-02 Thread Imsieke, Gerrit, le-tex

[Time since request: 30.071527000 seconds]

possible cause (just a wild guess): the AWS load balancer encountered 
the classic BaseX timeout of 30 seconds.


On 02.02.2022 21:22, Tim Thompson wrote:
Thanks for that. Still no luck, I'm afraid. Attached is the full HTTP 
info for the requests from BaseX (hostname info replaced with 
"example.org ").


I should be able to stick with GET requests for now, but would be nice 
to have access to POST as well.


All best,
Tim




Re: [basex-talk] Doc Loaded by db:create() has invalid URL according to base-uri()

2022-02-04 Thread Imsieke, Gerrit, le-tex

Reported by Eliot himself…

On 04.02.2022 11:15, Christian Grün wrote:
This is related to an older open issue on GitHub [1]; I hope I can fix 
it with BaseX 10.


Best,
Christian

[1] https://github.com/BaseXdb/basex/issues/1172 







Eliot Kimber > schrieb am Fr., 4. Feb. 2022, 01:54:


I think this is a bug:


…


Re: [basex-talk] How to extract value from fn:analyze-string

2022-02-10 Thread Imsieke, Gerrit, le-tex
It’s a namespace thing. The analyze-string() result is in the 
http://www.w3.org/2005/xpath-functions namespace, which is bound to the 
fn prefix. So you should write fn:match etc. instead of match, or, as 
Bridger suggested, *:match. But such a wildcard always seems a bit 
desperate to me (no offense, Bridger ;).
Whereas you don’t need to use the privileged fn prefix when you invoke 
analyze-string(), it’s only important when you select the namespaced 
results.


Gerrit

On 10.02.2022 18:30, Ben Engbers wrote:

Hi,

This query produces the following result:

let $debates := collection("Parliament")
for $debate-item in $debates
   let $item-file := $debate-item/officiele-publicatie//meta/@content
   let $debate-id := fn:analyze-string(
     $debate-item/officiele-publicatie//meta/@content, "(\d{8}-\d*)-(\d*)")
   return ($debate-id)

=>

http://www.w3.org/2005/xpath-functions";>
   https://zoek.officielebekendmakingen.nl/h-tk-
   
     20202021-102-1
   
   /metadata.xml

...

I am trying to extract the values from group 1 and 2 but this query 
returns 0 results:


let $debates := collection("Parliament")
for $debate-item in $debates
   let $item-file := $debate-item/officiele-publicatie//meta/@content
   let $debate-id := fn:analyze-string(
     $debate-item/officiele-publicatie//meta/@content, "(\d{8}-\d*)-(\d*)")

     let $debate-nr := $debate-id//match/group[@nr="1"]/text()
     let $item-nr := $debate-id//match/group[@nr="2"]/text()

   return ($debate-nr, $item-nr)

My guess is that analyze-string inserts new elements in the query and 
that that is the reason why this does not work.


How can I extract debate-nr and item-nr from $debate-id?

Ben Engbers




[basex-talk] How to produce multipart/mixed results with RESTXQ?

2022-02-21 Thread Imsieke, Gerrit, le-tex
I was faintly hoping that a sequence will be magically output as 
multipart/mixed with appropriate part content types when I annotate it 
with %rest:produces("multipart/mixed"):


declare
  %rest:GET
  %rest:path("/test")
  %rest:produces("multipart/mixed")
function my:test-multipart() {
  (, json:serialize(map{'some':'json'}))
};

But the response header says "Content-Type: application/xml", and the 
result is



{
  "some": "json"
}

Are there some other functions or annotations or rest:response elements 
that I can use in order to get multipart/mixed correctly assembled?

Bonus: With the possibility to add file names to each chunk?

Gerrit


Re: [basex-talk] feature request: opening database at arbitrary file path

2022-02-21 Thread Imsieke, Gerrit, le-tex
Or to say it more bluntly: Eric, start using BaseX productively before 
making feature requests that seem out-of-sync with BaseX’s architecture 
to core developers and to long-time users alike. The fact that no one 
has raised such a request in the last decade – no one has come forth to 
say “wow, if I could specify each database’s own directory, I could do 
things with less friction” – speaks volumes. This is not a request that 
a BaseX user would make, even if they thought about ways to embed the 
database engine in an application.


On 22.02.2022 00:50, Tamara Marnell wrote:

Hi Eric,

As you say, "XML and JSON databases are needed when the data consists of 
documents already occurring in such formats." BaseX databases are 
intended to be representations of physical files, so what operations are 
you performing on the databases that are not easily reproducible from 
the XML? You say if you move your project to a new system, you'll "lose 
all data from the database"--is your goal to ship out the databases as 
files for read-only access, without including the source documents? I'm 
not a BaseX dev, but I don't think that's its intended use.


Re: "In your model, all copies of my project would access the same 
database, on the same system." One folder of databases isn't the same as 
one database. Your project copies can each have their own database 
within BaseX; they just need to have distinct names like "db-prod" for 
documents stored in your production folder, "db-dev" for documents 
stored in your development folder, etc. You can construct your queries 
to access the database you want at the time by passing an external 
variable like:


declare variable $d as xs:string external;
for $result in db:open($d)/etc.

In that way you can access data representing files from anywhere on the 
machine, so it doesn't matter where the encrypted BaseX databases are 
stored. You can also copy databases into new ones for manipulation or 
preservation of a "state" with COPY original_db copied_db. If your 
changes in original_db get messed up and you want to restore, DROP DB 
original_db; COPY copied_db original_db.


Assuming every distribution of your project will contain the original 
files, or work based off of user-supplied files, there is no limitation 
to putting all databases under one directory. Your instructions for 
installation only need to include specifying that directory in the 
.basex file, or in a custom file of definitions if you want to set it 
programmatically; and running a script that constructs the BaseX 
database on that computer from the documents. Whenever I move our 
project to a new machine--which I did frequently during development--our 
scripts rebuilt our databases of ~42K documents, including full-text and 
custom indexes, in about five minutes.


-Tamara

On Mon, Feb 21, 2022 at 2:08 PM Eric Levy > wrote:


 > > > Maybe it helps to compare BaseX with other Open-Source SQL
 > > databases,
 > > > e.g. PostgreSQL: While it’s possibly to use it embedded,
 > > specifying a
 > > > simple path as target won’t suffice.
 > >
 > > SQL databases are most useful for data that may be represented
 > > naturally using a relational model.
 >
 > Sure. I simply wanted to illustrate that you cannot embed PostgreSQL
 > that easily in your project as you can embed SQLite.

I may have misunderstood the direction of your comment.

Broadly, as you suggest, the databases mentioned may be classified
according to two orthogonal traits, whether supporting server versus
embedded modes, and by the data or document model.

I had mentioned SQLite, because, even though it has a different data
model from that of BaseX, I thought it might useful to compare in terms
of how it resolves the location of the database. Among the use cases
for which SQLite has become successful is one in which a database
occurs in a portable project directory. Such flexibility makes it a
credible choice for managing relational data in contexts for which
PostgreSQL and other server-only database systems would be
inappropriate.

Presently, BaseX offers limited support for embedded use. It seems, at
least in principle, a feasible path is available to strengthen the
support for the embedded case by supporting a mode of opening a
database from a file path independent of data external to the path.
Such support, of course, may be added without imposing any constraints
on existing support for either embedded or server modes.


 > I suppose BaseX is not the right tool for you, as you seem to look
 > for something that's more light-weight.

It may not be the right tool, at least at present. I believe the
limitation is currently constrained to the issue I have raised, about
opening a database at a user-supplied location. In terms of essential
operational characteristics, I think the applic

Re: [basex-talk] feature request: opening database at arbitrary file path

2022-02-21 Thread Imsieke, Gerrit, le-tex

What is circular in “don’t waste our precious time”?

Pardon my French, but this is really a non-issue, or an issue that needs 
to wait in line after the request to allow more than 256 namespaces [1].


[1] https://github.com/BaseXdb/basex/issues/902 

On 22.02.2022 02:01, Eric Levy wrote:

On Mon, 2022-02-21 at 15:50 -0800, Tamara Marnell wrote:

Assuming every distribution of your project will contain the original
files, or work based off of user-supplied files, there is no
limitation to putting all databases under one directory. Your
instructions for installation only need to include specifying that
directory in the .basex file, or in a custom file of definitions if
you want to set it programmatically; and running a script that
constructs the BaseX database on that computer from the documents.
Whenever I move our project to a new machine--which I did frequently
during development--our scripts rebuilt our databases of ~42K
documents, including full-text and custom indexes, in about five
minutes.


I think you're not understanding the use, as your general framing is
quite far from what I have tried to explain. I'm not sure it would be
helpful for me to address each point you raised in detail.

I feel my explanations are generally clear, especially in light of the
context I offered, and I don't want to keep repeating myself. Perhaps
the SQLite documentation, especially the section "Appropriate Uses For
SQLite" [1], would provide a more robust or accessible representation
of embedded database applications than has emerged so far in the
discussion.

1. https://www.sqlite.org/whentouse.html



On Tue, 2022-02-22 at 01:16 +0100, Imsieke, Gerrit, le-tex wrote:

Or to say it more bluntly: Eric, start using BaseX productively
before
making feature requests that seem out-of-sync with BaseX’s
architecture
to core developers and to long-time users alike. The fact that no
one
has raised such a request in the last decade – no one has come forth
to
say “wow, if I could specify each database’s own directory, I could
do
things with less friction” – speaks volumes. This is not a request
that
a BaseX user would make, even if they thought about ways to embed
the
database engine in an application.


I made a request, and explained the use case, drawing from examples of
established design patterns.  The request may not be one you see as
aligned to the project objectives, which is fine, but the analysis
meets me as rather circular.




--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] Windows, WSL, and BaseX

2022-03-22 Thread Imsieke, Gerrit, le-tex

Hi Jonathan,

While I was able to launch the BaseX GUI (bin/basexgui) from WSL, the 
GUI experience is better when launching bin\basexgui.bat from cmd.exe, 
that is, from the Windwows shell.
As to basexhttp, I usually start it from WSL (in the same BaseX bin 
directory, using the same databases). I installed by unzipping the zip 
distribution somewhere below my Windows user directory (mounted as 
/mnt/c/Users/gerrit/ in WSL, I made a symlink ~/w that points to 
/mnt/c/Users/gerrit). I don’t remember whether I unzipped it on WSL or 
in Windows Explorer.
So yes, do use a single installation directory that is available both in 
Windows and in WSL. But maybe don’t use an installer; rather install it 
via unzipping the Zip release.


Gerrit

On 22.03.2022 23:29, Jonathan Robie wrote:
I installed Windows System for Linux and installed BaseX on it, and also 
installed BaseX on Windows.


Unfortunately, the two do not share databases. Is there a way to make 
them do so?  Or a way to run basexgui from WSL?   Or a better 
question that I should ask if I want to work productively on BaseX under 
Windows and am more accustomed to developing under Linux?


Jonathan


Re: [basex-talk] Support for performing queries on query results

2022-04-04 Thread Imsieke, Gerrit, le-tex
I don’t want to do injustice to all the other valuable contributors to 
this list, but…


Tamara, you are the most valuable contributor of 2022 so far. Not only 
for your competence, but also for your patience. (Christian will always 
be (co-) leading in terms of competence and patience, but I think he 
will agree that your contributions to this list matter a lot already.)


To my surprise and unless I’m overlooking something, you didn’t leave a 
trace in the archives [1] in previous years.


Thank you for becoming a significant part of this community!

Gerrit

[1] https://mailman.uni-konstanz.de/pipermail/basex-talk/

On 04.04.2022 20:50, Tamara Marnell wrote:

Hello Markus,

In your query, you're grouping only by $count but also returning 
$incidence. When you group by $count, you're creating a sequence of 
unique count values each associated with a sequence of $incidences. To 
illustrate:


{
for $x in $results
let $count := $x(1)
let $incidence := count($count)
group by $count
return {
   for $i in $incidence
   return {$i}
}
}

Will result in:


   
     1
     1
     1
   
   
     1
   


So when you attempt to print out {$incidence}, 
XQuery finds a sequence (1, 1, 1) instead of the value you want, 3.


To get the count of $incidence, you could return 
{count($incidence)} instead. But since you're not 
using the IDs at all, placing them in a sequence of arrays first isn't 
necessary. You can skip that part like:


for $x in //test_data/product
let $count := count($x/contributor)
let $id := $x/id/data()
group by $count
let $incidence := count($id)
order by $incidence descending
return

    
    {$count}
    {$incidence}
    
  

-Tamara

On Mon, Apr 4, 2022 at 8:30 AM Markus Elfring > wrote:


 > As I said, consider to provide an input/output sample of what you
have
 > and want to achieve, …

I did that a moment ago.
https://mailman.uni-konstanz.de/pipermail/basex-talk/2022-April/017045.html




A simple query can provide the following data display.

id|contributor_count
123|1
45|1
67|1
89|2


These data should be taken for another analysis.

contributor_count|incidence
1|3
2|1


This would be the expected output for such a test case.

I became curious if such a report result could be achieved also without
the generation of the first table.

Regards,
Markus



--

Tamara Marnell
Program Manager, Systems
Orbis Cascade Alliance (orbiscascade.org )
Pronouns: she/her/hers


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] User group meeting in Prague?

2022-04-10 Thread Imsieke, Gerrit, le-tex

Fellow BaseX Users,

Now most of you should be able to foresee whether you will make the 
journey to Prague in 2 months’ time.


Since the CFP ends on April 12, I need to make a decision whether to 
submit a proposal for a BaseX user group meeting quite soon.


I will do so if a quorum of 15 users (that is, excluding BaseX staff) is 
reached by Tuesday 22:00 UTC (mindnight CEST).


Add your name and a plus sign next to it if you are likely to attend 
physically: https://github.com/BaseXdb/user-group/wiki/Members


Drop me a note if you are unable to edit the Wiki pages on Github.

You may also submit a proposal for a presentation at 
https://github.com/BaseXdb/user-group/wiki/2022-06-XML-Prague


Gerrit




On 17.12.2021 17:02, Imsieke, Gerrit, le-tex wrote:

Fellow BaseX Users!

You might have heard that XML Prague 2022 will take place in June. 
(Unless the then-prevalent Greek letter makes it impossible even in that 
time of year, of course.)


I asked Christian whether the BaseX team will organize a user group 
meeting after it had not happened for years now. Christian didn’t seem 
to be very fond of organizing such a meeting. I asked him whether he 
would be available to present new features, the roadmap, and for a Q&A 
session if the users themselves organized such a meeting. He agreed, and 
therefore I hereby ask the list members whether anyone will join me in 
organizing this.


The plan looks as follows: We will apply for one or two 90-minute slots 
via the CFP process (https://www.xmlprague.cz/cfp/). We don’t need to 
have a fixed schedule yet by Dec. 20 (end of CFP date as currently 
announced – it will be extended anyway).


Christian was so kind as to create a new repo, user-group, on Github. We 
will use one or more of its Wiki pages [1] in order to plan the event. 
The page will eventually evolve into an agenda if you agree.


Looking forward to meeting many of you in Prague in June.

And another organizing volunteer (or other volunteers), please come 
forward. Maybe we can also deal with it in the Wiki [2].


Gerrit

[1] https://github.com/BaseXdb/user-group/wiki/2022-06-XML-Prague
[2] https://github.com/BaseXdb/user-group/wiki/Members


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] Basexgui Feature suggestion

2022-04-10 Thread Imsieke, Gerrit, le-tex

Yes, I do use Ctrl-F6 (in oXygen)

On 11.04.2022 08:37, Christian Grün wrote:
Thanks, Andy for fishing out the old issue on this; I remember you’ve 
once come up with a similar proposal.


We’re indeed using the standard Swing component for the tabs, and it’s 
always a bit risky to modify those (due to the different OS renderings). 
It migh be easier to add support for the Ctrl-F6 shortcut and provide a 
sorted list of all file names. In addition, we could add a drop-down 
component in the menu bar of the editor.


Does anyone of you use the shortcut, which is available in Eclipse, 
oXygen and some other IDEs?


Best,
Christian



Re: [basex-talk] Xquery all nodes between empty particular element tag and subsequent

2022-05-20 Thread Imsieke, Gerrit, le-tex

No, this is not the general solution yet.

Suppose that there is more markup in the text that is between the verse 
markers.


(And suppose the starting ID is 'Rev.22.15' since this ID is contained 
in your example.)


If the verse folling the start marker were like this:

Foris canes, et venefici, et impudici, et homicidæ, et idolis 
servientes, et omnis qui amat et facit mendacium.


only this text node would be returned:

Foris canes, et venefici, et

I propose this XQuery instead:

let $text := 
...

Beati, qui lavant stolas suas in sanguine Agni : ut sit potestas eorum 
in ligno vitæ, et per portas intrent in civitatem.


Foris canes, et venefici, et impudici, et homicidæ, et idolis 
servientes, et omnis qui amat et facit mendacium.


...
,
$start := $text//verse[@id = 'Rev.22.15'],
$end := $start/following-sibling::verse[1]
return $start/following-sibling::node()[. << $end]

Result: Foris canes, et venefici, et impudici, et homicidæ, et 
idolis servientes, et omnis qui amat et facit mendacium.



There may be more compact pure XPath expressions, but they will probably 
be less legible.


Gerrit



On 20.05.2022 08:40, Mark Bordelon wrote:
Perhaps I have just discovered my own answer. Would you all agree this 
is the best way?


xquery /text[starts-with(@id, 
'Bible.N')]//verse[@id='Rev.22.5']/following-sibling::node()[following-sibling::verse][1]


(simply limitie the returning sequence with [1])

On May 20, 2022, at 09:34, Mark Bordelon > wrote:


Gruss Gott, die Herren! Good day, fans and developers of basex!

After lots of searching online, I turn to you.

I have text loaded into my basex database in the following format


...

Beati, qui lavant stolas suas in sanguine Agni : ut sit potestas eorum 
in ligno vitæ, et per portas intrent in civitatem.


Foris canes, et venefici, et impudici, et homicidæ, et idolis 
servientes, et omnis qui amat et facit mendacium.

 and 
the following  tag,

I imagined it would be as simple as this:
> xquery /text[starts-with(@id, 
'Rev')]//verse[@id='Rev.22.1']/following-sibling::node()[following-sibling::verse]

But alas, the query does not stop searching at the following sibling, 
but continues to the end.


What is the correct syntax of the xpath to get what I need without 
specifying the particular end tag? I know the following works, but I 
require the more general query without the id of the ending tag.

> xquery /text[starts-with(@id, 
'Bible.N')]//verse[@id='Rev.22.1']/following-sibling::node()[following-sibling::verse[@id='Rev.22.2’]].

Thanks for your help!

Mark Bordelon






--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] ODBC support for BaseX?

2022-05-20 Thread Imsieke, Gerrit, le-tex
My reporting software for XML is called XSLT. The XML data it processes 
is sometimes saved from an XQuery result. Or I invoke the transformation 
to HTML with 
https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report directly 
from a RestXQ-annotated XQuery function.


On 20.05.2022 14:12, Markus Elfring wrote:

Maybe I am missing the point, so it would be interesting to know more about 
your motivation  😊


Report generators are available which can handle selected formats as data 
sources.
https://en.wikipedia.org/wiki/List_of_reporting_software

The chosen formats influence how challenging or convenient the desired data 
processing
would be for advanced reports and further data analyses.

Regards,
Markus


Re: [basex-talk] XML Catalog and xslt:transform()

2022-06-02 Thread Imsieke, Gerrit, le-tex

Hi Daniel,

I think the catalog in xslt:transform() is only used for XSLT 
imports/includes and maybe for reading documents with doc(), and only 
for Saxon. The catalog is probably *not* used for mapping system 
identifiers in the documents accessed this way. We should document this 
better once we find out what is/isn’t supported.


The background is that we desperately needed to use catalogs for mapping 
import/include URIs, and we paid Liam to implement this. He succeeded 
with a little help from Christian, but it was not an easy feat because 
include/import URI resolution is different from doc() URI resolution in 
Saxon which in turn is different from system identifier resolution (that 
is probably done by the XML parser, not by Saxon).


So I think we need to pay Liam and Christian again so that they work out 
how to pass the catalog to the XML parser that is invoked by Saxon. This 
definitely isn’t a fun task.


Gerrit

On 02.06.2022 14:44, Zimmel, Daniel wrote:

Hi,

after reading https://docs.basex.org/wiki/Catalog_Resolver and digging in the 
list archives 
(https://mailman.uni-konstanz.de/pipermail/basex-talk/2019-March/014199.html ) 
I still have trouble understanding catalog files.

Is this supposed to work with xslt:transform() and BaseX GUI 9.7.2?
The default option (DTD = false) is ignored by xslt:transform() because the 
function is definitely requesting the external DTD.
This prevents transforming XML with DTD declarations that are not available (if 
I understand correctly, a problem that the DTD option is trying to solve in 
general).

When I try to solve this via catalog files (actually I do not need the DTD), I 
do not have success.
Here are my mini examples:

Saxon HE 10.3 resides in the lib folder

.basex setting:
# Local Options
SERIALIZER = indent=no
DTD = true

XML in local folder "C:/temp/catalog":
http://www.blahblahblah.info/dtd/dokument.dtd";>

   01


catalog.xml in local folder "C:/temp/catalog":

   http://www.blahblahblah.info/dtd/"; 
rewritePrefix="file:///C:/temp/catalog/dtd/"/>


dokument.dtd in local folder "C:/temp/catalog/dtd":



XQuery query.xq in local folder "C:/temp/catalog":
(# db:catfile catalog.xml #) {
   xslt:transform('dokument.xml', 'transform.xsl')
}


With or without pragma, this always results in a java.net.UnknownHostException (because 
the system ID is not available, that's true), but I would be expecting this would resolve 
to "file:///C:/temp/catalog/dtd/dokument.dtd"

Not working in GUI nor via CCL.

What am I getting wrong?

Thanks, Daniel



--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] XML Catalog and xslt:transform()

2022-06-02 Thread Imsieke, Gerrit, le-tex
As a workaround, you might be able to read the documents using doc() in 
XQuery (this might work with the help of the catalog, in contrast to 
doc() from within XSLT/Saxon) and pass them to xslt:transform() in some 
way. “Some way” isn’t easy, either, since xslt:transform() still relies 
on JAXP, and you can’t pass arbitrary XDM items such as whole documents 
or maps as stylesheet parameters (or can you? $params as map(*)? doesn’t 
rule this out, but I doubt that a parameter may have another map as 
value and arrive safely at the stylesheet). So you might need to wrap 
all inputs in a single top-level element, which of course prevents you 
from letting the XSLT stylesheet decide which resource to load 
dynamically, and you might need to change matching patterns.
But switching to XDM and implementing XPath 3.1’s fn:transform() 
function that would allow to was too much of a stretch for Christian at 
the time we paid BaseX GmbH to implement xslt:transform-report(). I 
think this will need another significant investment, and Christian needs 
to find time to implement it.


Gerrit

On 02.06.2022 16:24, Imsieke, Gerrit, le-tex wrote:

Hi Daniel,

I think the catalog in xslt:transform() is only used for XSLT 
imports/includes and maybe for reading documents with doc(), and only 
for Saxon. The catalog is probably *not* used for mapping system 
identifiers in the documents accessed this way. We should document this 
better once we find out what is/isn’t supported.


The background is that we desperately needed to use catalogs for mapping 
import/include URIs, and we paid Liam to implement this. He succeeded 
with a little help from Christian, but it was not an easy feat because 
include/import URI resolution is different from doc() URI resolution in 
Saxon which in turn is different from system identifier resolution (that 
is probably done by the XML parser, not by Saxon).


So I think we need to pay Liam and Christian again so that they work out 
how to pass the catalog to the XML parser that is invoked by Saxon. This 
definitely isn’t a fun task.


Gerrit

On 02.06.2022 14:44, Zimmel, Daniel wrote:

Hi,

after reading https://docs.basex.org/wiki/Catalog_Resolver and digging 
in the list archives 
(https://mailman.uni-konstanz.de/pipermail/basex-talk/2019-March/014199.html 
) I still have trouble understanding catalog files.


Is this supposed to work with xslt:transform() and BaseX GUI 9.7.2?
The default option (DTD = false) is ignored by xslt:transform() 
because the function is definitely requesting the external DTD.
This prevents transforming XML with DTD declarations that are not 
available (if I understand correctly, a problem that the DTD option is 
trying to solve in general).


When I try to solve this via catalog files (actually I do not need the 
DTD), I do not have success.

Here are my mini examples:

Saxon HE 10.3 resides in the lib folder

.basex setting:
# Local Options
SERIALIZER = indent=no
DTD = true

XML in local folder "C:/temp/catalog":
http://www.blahblahblah.info/dtd/dokument.dtd";>

   01


catalog.xml in local folder "C:/temp/catalog":
xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
   systemIdStartString="http://www.blahblahblah.info/dtd/"; 
rewritePrefix="file:///C:/temp/catalog/dtd/"/>



dokument.dtd in local folder "C:/temp/catalog/dtd":



XQuery query.xq in local folder "C:/temp/catalog":
(# db:catfile catalog.xml #) {
   xslt:transform('dokument.xml', 'transform.xsl')
}


With or without pragma, this always results in a 
java.net.UnknownHostException (because the system ID is not available, 
that's true), but I would be expecting this would resolve to 
"file:///C:/temp/catalog/dtd/dokument.dtd"


Not working in GUI nor via CCL.

What am I getting wrong?

Thanks, Daniel





--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt


Re: [basex-talk] XML Catalog and xslt:transform()

2022-06-02 Thread Imsieke, Gerrit, le-tex




On 02.06.2022 16:56, Zimmel, Daniel wrote:

I see, thanks Gerrit and Christian for the insight. This *does* sound wickedly 
unfunny.

OK if I actually do not need to be able to parse the DTD wouldn't the simple 
workaround be:

fetch:xml('file:///C:/temp/catalog/dokument.xml')
=> xslt:transform('transform.xsl')

At least this is what works here, resulting in a new document node and trashing 
the DTD declaration.


Yes, that should solve your issue. If you only want to read the primary 
XSLT input and don’t need to resolve any named entities, that’s easier 
than doc() from XQuery with catalogs enabled what I suggested.


Gerrit


[basex-talk] I can’t use character maps with RESTXQ

2022-06-22 Thread Imsieke, Gerrit, le-tex
For HTML with embedded Javascript, I need to output > as > rather than 
as >


In XSLT I’m doing


  

  


and

encoding="UTF-8" use-character-maps="a" omit-xml-declaration="no" 
html-version="5.0"

doctype-public="" doctype-system=""/>



In RESTXQ I tried the following:

I created a document called html-charmap.xml with the following content:


http://www.w3.org/2010/xslt-xquery-serialization";>
   
 
   


It resides in the directory where the xqm is located. The xqm contains 
this function:


module namespace my = 'my';

declare
  %rest:GET
  %rest:path("/charmap/test")
  %output:method("xhtml")
  %output:html-version("5.0")
  %output:parameter-document("html-charmap.xml")
  %rest:produces("text/html")
function my:html() {
  

  Charmap Test
  
   alert('You are in ' + 
(document.compatMode==='CSS1Compat'?'Standards':'Quirks') + ' mode and 1 
> 0 is ' + (1 > 0)



  Charmap Test
  >
  >

  
};

When I retrieve /charmap/test, all > characters are still escaped as >

When I change %output:parameter-document to 
%output:parameter-document("tml-charmap.xml"), BaseX doesn’t complain 
about the missing parameter document.


What am I doing wrong?

In XSLT 3 with Saxon, I can also do



and this will use html-charmap.xml and it will complain when it’s the 
wrong file name.


Gerrit


Re: [basex-talk] I can’t use character maps with RESTXQ

Correction & for completeness: I forgot a closing parenthesis in 
Javascript (but this isn’t causing the unused character map issue, of 
course…):


On 22.06.2022 11:53, Imsieke, Gerrit, le-tex wrote:
    alert('You are in ' + 
</tt><tt>(document.compatMode==='CSS1Compat'?'Standards':'Quirks') + ' mode and 1 
</tt><tt> > 0 is ' + (1 > 0)


 alert('You are in ' + 
</tt><tt>(document.compatMode==='CSS1Compat'?'Standards':'Quirks') + ' mode and 1 
</tt><tt>> 0 is ' + (1 > 0) )


  1   2   >