[basex-talk] Serialization mismatch using Saxon for xslt:transform

2019-08-07 Thread Majewski, Steven Dennis (sdm7g)

Continuing with my test.xqm experiments… 

I have copied Saxon jar into WEB-INF/lib/  so xslt:transform is using Saxon. 

I have the following functions declared:

  declare
%rest:path("test/xqdoc.xml")
%output:method('xml')
function test:doc() {
  inspect:xqdoc( $test:module_name )
};

declare
   %rest:path('test/xdoc')
   %output:method('html’)   (: I’ve tried various values 
for method and html-version here ! :) 
   %output:html-version('5.0')
   function test:htmldoc() {
 (:  WTF? :)
 xslt:transform( test:doc(),'static/xsl/html-module.xsl', map { 'source' : 
'test.xqm' })
   };


Where html-module.xsl initially was:  
https://github.com/xquery/xquerydoc/blob/master/src/lib/html-module.xsl 
 


Accessing /basex/test/xdoc  returns error message: 

Stopped at /usr/local/tomcat/webapps/basex/test.xqm, 41/20:
[FODC0002] "" (Line 69): The entity "nbsp" was referenced, but not declared.

Which was initially very puzzling, as I could not find nbsp in either my 
test.xqm, html-module.xsl, or inspect:xsdoc() output. 
Turns out, even though it was encoded as  "” in html-module.xsl, Saxon 
was encoding it as “” on output of the transform. 

Initially, I wasn’t sure if Saxon or BaseX was doing the serialization. I guess 
it seems to be  both. 

Original output method for that stylesheet is:


And changing output:method  on the function to xhtml or html doesn’t have any 
effect on results.
Changing output method on the stylesheet to xhtml causes Saxon to serialized it 
as “”  instead of “” , and the serialization method on the basex 
RESTXQ function doesn’t seem to give an errors with any output methods.

I take from these results that the output from Saxon xslt:transform is 
serialized according to the stylesheet, and then parsed again by BaseX as xml 
on the way to being serialized again on output from the function, and the error 
is coming from that implicit parse. 

I don’t suppose there is a way to short circuit the parsing of the 
xslt:transform function output and just output the results directly (?)
I tried xslt:transform-text() but it escapes all of the element tags. 
Or a way to get it to parse the results of that transform function as html ? 

Clearly changing the stylesheet is the easy solution for this test file, but 
for some of my other real cases, I may be trying to repurpose stylesheets that 
will be used in different contexts: within BaseX and outside of that context, 
so keeping different versions of the stylesheets is going to be annoying. 
I suppose I could read in the stylesheets and modify the xml:output line in 
XQuery or XSLT before using it within BaseX.  


— Steve M. 






smime.p7s
Description: S/MIME cryptographic signature


Re: [basex-talk] comment()

2019-08-07 Thread Majewski, Steven Dennis (sdm7g)


Also literal  work just like other literal XML, as there is 
a different syntax for (: XQuery comments  :) 

XQuery: { collection()[1]//comment() }  
{ comment { " last comment " } }  (: XQuery Comment :) 

Produced output:


  
  
  
  
  
  



"comment()"   is the XPath syntax to match a comment node, not a function that 
creates comments. 

— Steve M. 



> On Aug 7, 2019, at 1:03 PM, Martin Honnen  wrote:
> 
> On 07.08.2019 18:52, Marc wrote:
> 
>> I want to write a comment in the xml I produce with my XQuery.
>> I try to use the comment() function, but each time I want to put
>> something inside the () i have a syntax error.
> 
> If you want to create a comment node computed by an expression use
>  comment { expression }
> 
> see https://www.w3.org/TR/xquery-31/#doc-xquery31-CompCommentConstructor
> 
> So
>  comment { $r }
> seems to be what you want to do.



smime.p7s
Description: S/MIME cryptographic signature


Re: [basex-talk] comment()

2019-08-07 Thread Martin Honnen

On 07.08.2019 18:52, Marc wrote:


I want to write a comment in the xml I produce with my XQuery.
I try to use the comment() function, but each time I want to put
something inside the () i have a syntax error.


If you want to create a comment node computed by an expression use
  comment { expression }

see https://www.w3.org/TR/xquery-31/#doc-xquery31-CompCommentConstructor

So
  comment { $r }
seems to be what you want to do.


[basex-talk] comment()

2019-08-07 Thread Marc

Hi,
I want to write a comment in the xml I produce with my XQuery.
I try to use the comment() function, but each time I want to put 
something inside the () i have a syntax error.


for example :

{comment("test"),
  let $r := random:integer(100) + 1
for $j in (/*)[$r]
return (
  $r,$j)
}


or (who is more what I want to do)


{
  let $r := random:integer(100) + 1
for $j in (/*)[$r]
return (comment("$r"),$j)
}


I don't find any example on how to use the comment function.
Anyone have example about that use?

Thanks

Marc


[basex-talk] BaseX in AWS Lambda - has anyone tried it?

2019-08-07 Thread James Ball
Good afternoon,

I’m currently working on a project where I get lots - maybe thousands - of XML 
files and I have to run a series of tests on them. I get a whole batch then 
maybe none for a week.

I have all my code in XQuery in BaseX but with some locking and update issues 
it can take a long time to process.

So I thought I might give AWS Lambda a try as all the tests can run 
independently.

Before I jump in I wondered if anyone else has tried it? Any thoughts, 
suggestions, issues?

I did a search of the list but didn’t see anything.

Many thanks, James