Open martin-honnen opened 2 years ago
Martin, I’m currently on holiday but should be able to look at your question about Wednesday or Thursday this week
John
Sent from my iPad
On 25 Jul 2022, at 10:58, martin-honnen @.***> wrote:
Hi John,
I have started to try to integrate your Invisible XML library in my XSLT 3, SaxonJS based fidde at https://martin-honnen.github.io/xslt3fiddle/index-iXML.html. I hope I have understood the documentation and comments in the code fine, I have run into one oddity where I wonder whether your function signature or the type checking in the function can be improved.
Sometimes I expect the input XML of the XSLT transformation to contain a grammar to be parsed in some XML element e.g. in a sample I have
<?xml version="1.0" encoding="utf-8"?>
Saxon-JS 2.4 XSLT 3 and iXML fiddle jwiXML Test
Invisible XML example
Grammar
Countries = Country*. Country = Name, -'/', Code, -'/', Line, #A?. Name = ['A'-'Z'],['A'-'Z']. Code = ['0'-'9'],['0'-'9'],['0'-'9']. Line = ['0'-'9'],['0'-'9'].
Sample data
UK/006/10 US/004/12
and then it "only" works fine to pass the string value of that code id="grammar1" element to the jwL:compileGrammar function, i.e. doing
<xsl:sequence ***@***.*** = 'grammar1']/string()), ***@***.*** = 'data'])?tree"/>
works fine, however simply passing the element node, as in
<xsl:sequence @. = 'grammar1']), @. = 'data'])?tree"/> gives me an error Failed to call method function(a){a instanceof Document?(a=Cb(a),a.compile()):(a=(new Db).parse(a),a.compile());return a}.
Is that expected? I am afraid I am not able to infer what the minimized Cb(a) or (new Db).parse(a) are supposed to do or what kind of input they take.
So I need your help to tell me whether the explicit string conversion I needed to do is a wanted requirement or whether you can improve the function/API to do that automagically.
Full examples are: failure , success.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
Thanks, @johnlumle, with your update the test now works fine.
Hi John,
I have started to try to integrate your Invisible XML library in my XSLT 3, SaxonJS based fidde at https://martin-honnen.github.io/xslt3fiddle/index-iXML.html. I hope I have understood the documentation and comments in the code fine, I have run into one oddity where I wonder whether your function signature or the type checking in the function can be improved.
Sometimes I expect the input XML of the XSLT transformation to contain a grammar to be parsed in some XML element e.g. in a sample I have
and then it "only" works fine to pass the string value of that
code id="grammar1"
element to thejwL:compileGrammar
function, i.e. doingworks fine, however simply passing the element node, as in
gives me an error
Failed to call method function(a){a instanceof Document?(a=Cb(a),a.compile()):(a=(new Db).parse(a),a.compile());return a}
.Is that expected? I am afraid I am not able to infer what the minimized
Cb(a)
or(new Db).parse(a)
are supposed to do or what kind of input they take.So I need your help to tell me whether the explicit string conversion I needed to do is a wanted requirement or whether you can improve the function/API to do that automagically.
Full examples are: failure , success.