Project

Profile

Help

Bug #5494 ยป Re_ [SaxonJS - Bug #5494] Properties of attribute nodes have internal names which change from one release to another - 2022-05-23T23_51_43Z.eml

Jai B, 2022-05-24 01:51

 
X-He-Spam-Score: -2.2
Return-Path: <jai@paytrie.com>
Delivered-To: dropbox@plan.io
Received: from m.launch.gmbh ([127.0.0.1])
by m.launch.gmbh with LMTP id mAKkAgIejGLfTAAAJzdhvw
for <dropbox@plan.io>; Tue, 24 May 2022 01:51:30 +0200
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on m.launch.gmbh
X-Spam-Level:
X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,
RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Report:
* -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at
* https://www.dnswl.org/, no trust
* [209.85.218.53 listed in list.dnswl.org]
* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
* [score: 0.0000]
* -0.1 SPF_PASS SPF check passed
* -0.1 DMARC_PASS DMARC check passed
* 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3)
* [209.85.218.53 listed in wl.mailspike.net]
* 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
* 0.0 HTML_MESSAGE BODY: HTML included in message
* -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
* -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
* author's domain
* 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
* valid
* 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders
* -0.0 T_SCC_BODY_TEXT_LINE No description available.
X-Spam-Score: -2.2
Envelope-to: inbox+saxonica+f38e+saxon-js@plan.io
Authentication-Results: m.launch.gmbh; dmarc=pass (p=none dis=none) header.from=paytrie.com
Authentication-Results: m.launch.gmbh; spf=pass smtp.mailfrom=jai@paytrie.com
Authentication-Results: m.launch.gmbh;
dkim=pass (2048-bit key; unprotected) header.d=paytrie.com header.i=@paytrie.com header.b="baIWfsic";
dkim-atps=neutral
Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))
(No client certificate requested)
by m.launch.gmbh (Postfix) with ESMTPS id ADAC180173
for <inbox+saxonica+f38e+saxon-js@plan.io>; Tue, 24 May 2022 01:51:29 +0200 (CEST)
Received: by mail-ej1-f53.google.com with SMTP id y13so31270514eje.2
for <inbox+saxonica+f38e+saxon-js@plan.io>; Mon, 23 May 2022 16:51:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=paytrie.com; s=google;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=AlwzKXXwXHcrquP/lfP8P0p/+JnskEtdpdG8vgauxK4=;
b=baIWfsic6VhYNU+jRyYWL0fJFrgwoHhnUwrLz+Sf2IrphJGrMM8DyV0PIHLi/abyoN
ZrOH9ZdXLgNg1Aut5q2a0CD23ZjzGbxrRc2Cml5+9ywqTyz6zsPVJlDvBVafjha1Rkeu
w5GAoDMDI8UXQiYPHzmK6ofXZ5MqVLLOowsI6MPVYAyWAwPPM27Awg9kw+XFmkD0hmty
TZKJU2lI8KPHbzqAX4QLfEhVzl3kgMSYGi5QMvhJHbJfeibldifs0+euHb/2iPPeZdnL
B3eH/khGSPkKHAwZc/ziyFhn/ZInzcb34lCzFpiQVygs4OwZDughTMo4U14c6JdCiCjl
KoCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=AlwzKXXwXHcrquP/lfP8P0p/+JnskEtdpdG8vgauxK4=;
b=MKUFB3I3oXUIbCMsA1h9T+wcaFtrUVZ696uLKIuG1YxXYBoEieEozwHgZoatUtMMA0
QKPa8k/WtUN23KFnDSu57iO9i6O+6/M/g06/VAkKsuUaitnzyyfS5odvsxLkP8fa8J/E
AIKqOBQokAOaPLdeKW7jYbiOBSa78PeZ+BbRvUvc6L55MmRgCqILLriwn+YkVwtYhGBY
rRstWzQnsKSpY1RDgCfCLWE3rvj0zx20v7uV1rsMr4rwhPhRAv1EQpEUE7/HT5+dG/Gb
r64OFrnb9aYNTQeOcKbjrKLSFXB3ZzqVp2UbGbSF3hPualtoRbPFYaD6jJR57NS0Tm7Q
6jnw==
X-Gm-Message-State: AOAM532vD0nfAlD4z4pjaV4vY3SVcIKWIj5bCpR6pfi50nQeP/QGrGuJ
MAZYlq0faOgVf4401PCraIhsYM7p/T8gHahkdB73wfD2Apo=
X-Google-Smtp-Source: ABdhPJzSeyIZJwUHPzs9Jb3izS/cTu9JhzaITDNiqLtN+kHoOpupBcF80NduYCJjNfxNLD2vZ2ABMCzBS7CTPQ++yR0=
X-Received: by 2002:a17:907:98c4:b0:6fe:a1e6:eae5 with SMTP id
kd4-20020a17090798c400b006fea1e6eae5mr18044479ejc.309.1653349886964; Mon, 23
May 2022 16:51:26 -0700 (PDT)
MIME-Version: 1.0
References: <redmine.issue-5494.20220518102551.3946@plan.io> <redmine.journal-20816.20220523094910.3946@plan.io>
In-Reply-To: <redmine.journal-20816.20220523094910.3946@plan.io>
From: Jai B <jai@paytrie.com>
Date: Mon, 23 May 2022 17:50:48 -0600
Message-ID: <CAC7ausPVE1A75WQ-tktB_UtyxViGTzSncb0i5vyLrCC9yXVDAQ@mail.gmail.com>
Subject: Re: [SaxonJS - Bug #5494] Properties of attribute nodes have internal
names which change from one release to another
To: Saxonica Developer Community <inbox+saxonica+f38e+saxon-js@plan.io>
Content-Type: multipart/alternative; boundary="000000000000b3d08905dfb68422"

--000000000000b3d08905dfb68422
Content-Type: text/plain; charset="UTF-8"

As I said, wasn't sure if was using wrong or actual issue (partly due to
lacking docs specifically for js version; but I get you're working on it
and I appreciate having it at all)

I will try and implement your suggestions next time I have a chance to go
into xsltHandler.js, sounds like I should be able to access what I need
w/out needing to access the compiled internals.

On Mon, May 23, 2022 at 3:49 AM Saxonica Developer Community <
notifications@plan.io> wrote:

> --- In your reply, please do not write below this line ---
> Issue #5494 <https://saxonica.plan.io/issues/5494?pn=1#change-20816> has
> been updated by Norm Tovey-Walsh.
> ------------------------------
>
> - *Assignee* set to *Norm Tovey-Walsh*
>
> The property you're after is called 'parent' in our API where DOM Attr
> nodes would call it 'ownerElement'. Exposing the property named parent
> with a consistent name is straightforward. I think we're unlikely to try to
> change its name. While 'ownerElement' would be more consistent with the
> DOM, 'parent' is more consistent with XDM.
> ------------------------------
> Bug #5494: Properties of attribute nodes have internal names which change
> from one release to another
> <https://saxonica.plan.io/issues/5494?pn=1#change-20816> open
>
> - *Author: *Jai B
> - *Status: *In Progress
> - *Priority: *Normal
> - *Assignee: *Norm Tovey-Walsh
> - *Category: *API
> - *Start date: *2022-05-18
> - *Company: *Jai B
> - *Contact person: *Jai B
> - *Additional contact persons: *
>
> Hi,
>
> This very well may not be a bug but perhaps user error, but it appeared
> when upgrading to 2.4.0.
>
> Have XSLT files that are used for templates for a website generating
> XHTML5 output.
>
> We have some tags in them like, <ff:component src="" />, we have our
> namespace 'ff' set in the templates and also set with XPathOptions in order
> to make Saxon not complain.
>
> After compiling the stylesheet and getting the result, we do
> SaxonJS.XPath.evaluate for the component elements and add them to an array
> of objects with the components name and the element itself.
>
> On Saxon 2.3.0, when calling .next() on a returned element from evaluate,
> the node in the object returned was referenced as .kb, since 2.4.0 it is
> now referenced as .eb.
>
> In the first place, I'm not sure why the names would be 'eb' or 'kb'
> versus something like 'childNode'.
>
> I am passing .principalResult from SaxonJS.transform() on a sef file that
> was originally compiled from the XSLT sources; we cache the sef and only
> recompile if the XSLT has changed, while the input XML obviously would
> change more often.
>
> this.XPathOptions = {
> resultForm:'iterator',
> namespaceContext:{
> 'xsl':'http://www.w3.org/1999/XSL/Transform',
> 'ff':'http://www.shaped.ca/freeform'
> }
> };
>
> ...
>
> let ffComponentNodes = this.saxon.XPath.evaluate('//ff:component/@name',doc,this.XPathOptions);
>
> for (let x=ffComponentNodes.next();x!=null;x=ffComponentNodes.next()) {
> logger.log(util.inspect(x))
> ffComponents.push({
> name:x.value,
> node:x.eb // wtf? x.kb for saxon 2.3.0?? ughwtf
> });
> }
>
> for (let component of ffComponents) {
> ...
> component.node.parentNode.replaceChild(componentChunk.firstChild,component.node);
> }
>
>
> I'm not sure if I'm doing something wrong, if this is an actual issue/bug
> but it only popped up when using 2.4.0 and jumping back to 2.3.0 resolved
> it; also, changing from using x.kb to x.eb also seemed to fix it.
>
> Are these variables just the result of some sort of transpilation?
>
> Also, I can't seem to find any information regarding this and I've
> searched pretty heavily. I know that JSON is an option for input in a way,
> although most of the references I can seem to find about this seem to imply
> that people are using an XSLT stylesheet to dictate how to translate JSON
> to XML or vice-versa.
>
> What I want to do is a little different; I want to provide the input data
> for an XSLT template that would normally be XML, as JSON instead. My XSLT
> stylesheets are basically webpage templates with the XML input being the
> data to fill them out. Now that my system is all on node, I feel like I'm
> doing a needless step converting my data from JSON->XML before translating
> it, I'd like to be able to just use JSON as input but I haven't had any
> luck by setting sourceType: 'json' in the .transform({options})..? If this
> is possible is there somewhere I can find some better docs on it?
>
> I feel like there's potentially more functionality available in SasonJS
> too that's not as well documented; I would love to see the documentation
> improved perhaps.
>
> Previously my web platform used PHP and XSLT templates for just about
> everything; it seems time to perhaps use Node instead and SaxonJS seems to
> be my best bet for templates and so far it's mostly working great, although
> there's a few oddities I haven't figured out, I will likely post in the
> forum now that I'm signed up.
> ------------------------------
>
> You have received this notification because you have either subscribed to
> or are involved in a project on Saxonica Developer Community site. To
> change your notification preferences, please click here:
> https://saxonica.plan.io/my/account?tour=mail_preferences
>
> This notification was cheerfully delivered by <https://plan.io/>
> [image: Planio] <https://plan.io/>
>


--
Cheers,
Jai

--000000000000b3d08905dfb68422
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">As I said, wasn&#39;t sure if was using wrong or actual is=
sue (partly due to lacking docs specifically for js version; but I get you&=
#39;re working on it and I appreciate having it at all)<div><br></div><div>=
I will try and implement your suggestions next time I have a chance to go i=
nto xsltHandler.js, sounds like I should be able to access what I need w/ou=
t needing to access the compiled internals.</div></div><br><div class=3D"gm=
ail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, May 23, 2022 at 3:=
49 AM Saxonica Developer Community &lt;<a href=3D"mailto:notifications@plan=
.io">notifications@plan.io</a>&gt; wrote:<br></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex"><u></u>







<div style=3D"font-family:ProximaNova-Regular,Helvetica,Arial,sans-serif;fo=
nt-size:14px;line-height:1.4em;color:rgb(51,52,52)">
<table width=3D"100%" cellspacing=3D"0" cellpadding=3D"0" style=3D"border-c=
ollapse:collapse;border-spacing:0px;margin-bottom:0px;width:100%;border:non=
e;padding:0px">
<tbody><tr><td style=3D"text-align:center;width:100%;font-family:MarketWeb,=
Helvetica,Arial,sans-serif;font-size:0.8em;color:rgb(215,215,215);border:no=
ne;padding:0px"><p>--- In your reply, please do not write below this line -=
--</p></td></tr>
<tr><td style=3D"border:none;padding:0px">Issue <a href=3D"https://saxonica=
.plan.io/issues/5494?pn=3D1#change-20816" style=3D"color:rgb(0,136,183)" ta=
rget=3D"_blank">#5494</a> has been updated by Norm Tovey-Walsh.
<hr style=3D"width:100%;height:1px;background:rgb(204,204,204);border:0px;m=
argin:1.2em 0px">

<ul style=3D"color:rgb(149,149,149);margin-bottom:1.5em">
<li><strong>Assignee</strong> set to <i>Norm Tovey-Walsh</i></li>
</ul>

<p>The property you&#39;re after is called &#39;parent&#39; in our API wher=
e DOM Attr nodes would call it &#39;ownerElement&#39;. Exposing the propert=
y named <code style=3D"font-family:Hack,Consolas,Menlo,&quot;Liberation Mon=
o&quot;,Courier,monospace;font-size:85%;background-color:rgb(236,236,236);b=
order-radius:3px;padding:0.2em;margin:0px">parent</code> with a consistent =
name is straightforward. I think we&#39;re unlikely to try to change its na=
me. While &#39;ownerElement&#39; would be more consistent with the DOM, &#3=
9;parent&#39; is more consistent with XDM.</p>
<hr style=3D"width:100%;height:1px;background:rgb(204,204,204);border:0px;m=
argin:1.2em 0px">
<h1 style=3D"font-family:ProximaNova-Bold,Helvetica,Arial,sans-serif;font-w=
eight:normal;margin:0px;font-size:1.3em;line-height:1.4em">
<a href=3D"https://saxonica.plan.io/issues/5494?pn=3D1#change-20816" styl=
e=3D"color:rgb(0,136,183);text-decoration:none" target=3D"_blank">Bug #5494=
: Properties of attribute nodes have internal names which change from one r=
elease to another</a>
<span style=3D"font-weight:bold;font-size:10px;padding:1px 3px;margin-rig=
ht:2px;margin-left:2px;border-radius:2px;text-transform:uppercase;text-deco=
ration:none;color:rgb(32,93,134);border:1px solid rgb(32,93,134)">open</spa=
n>
</h1>

<ul style=3D"color:rgb(149,149,149);margin-bottom:1.5em"><li><strong>Author=
: </strong>Jai B</li>
<li><strong>Status: </strong>In Progress</li>
<li><strong>Priority: </strong>Normal</li>
<li><strong>Assignee: </strong>Norm Tovey-Walsh</li>
<li><strong>Category: </strong>API</li>
<li><strong>Start date: </strong>2022-05-18</li>
<li><strong>Company: </strong>Jai B</li>
<li><strong>Contact person: </strong>Jai B</li>
<li><strong>Additional contact persons: </strong></li></ul>

<p>Hi,</p>
<p>This very well may not be a bug but perhaps user error, but it appeared =
when upgrading to 2.4.0.</p>
<p>Have XSLT files that are used for templates for a website generating XHT=
ML5 output.</p>
<p>We have some tags in them like, &lt;ff:component src=3D&quot;&quot; /&gt=
;, we have our namespace &#39;ff&#39; set in the templates and also set wit=
h XPathOptions in order to make Saxon not complain.</p>
<p>After compiling the stylesheet and getting the result, we do SaxonJS.XPa=
th.evaluate for the component elements and add them to an array of objects =
with the components name and the element itself.</p>
<p>On Saxon 2.3.0, when calling .next() on a returned element from evaluate=
, the node in the object returned was referenced as .kb, since 2.4.0 it is =
now referenced as .eb.</p>
<p>In the first place, I&#39;m not sure why the names would be &#39;eb&#39;=
or &#39;kb&#39; versus something like &#39;childNode&#39;.</p>
<p>I am passing .principalResult from SaxonJS.transform() on a sef file tha=
t was originally compiled from the XSLT sources; we cache the sef and only =
recompile if the XSLT has changed, while the input XML obviously would chan=
ge more often.</p>
<pre style=3D"font-family:Hack,Consolas,Menlo,&quot;Liberation Mono&quot;,C=
ourier,monospace;font-size:85%;background-color:rgb(236,236,236);margin:1em=
0px;padding:8px;border:none;border-radius:3px;width:auto;overflow:auto hid=
den"><code style=3D"font-family:Hack,Consolas,Menlo,&quot;Liberation Mono&q=
uot;,Courier,monospace;font-size:85%;background-color:rgb(236,236,236);bord=
er-radius:3px;margin:0px;padding:0px"> this.XPathOptions =3D {
resultForm:&#39;iterator&#39;,
namespaceContext:{
&#39;xsl&#39;:&#39;<a href=3D"http://www.w3.org/1999/XSL/Transform" tar=
get=3D"_blank">http://www.w3.org/1999/XSL/Transform</a>&#39;,
&#39;ff&#39;:&#39;<a href=3D"http://www.shaped.ca/freeform" target=3D"_=
blank">http://www.shaped.ca/freeform</a>&#39;
}
};

...

let ffComponentNodes =3D this.saxon.XPath.evaluate(&#39;//ff:component/@n=
ame&#39;,doc,this.XPathOptions);

for (let x=3DffComponentNodes.next();x!=3Dnull;x=3DffComponentNodes.next(=
)) {
logger.log(util.inspect(x))
ffComponents.push({
name:x.value,
node:x.eb // wtf? x.kb for saxon 2.3.0?? ughwtf
});
}

for (let component of ffComponents) {
...
component.node.parentNode.replaceChild(componentChunk.firstChild,compone=
nt.node);
}

</code></pre>
<p>I&#39;m not sure if I&#39;m doing something wrong, if this is an actual =
issue/bug but it only popped up when using 2.4.0 and jumping back to 2.3.0 =
resolved it; also, changing from using x.kb to x.eb also seemed to fix it.<=
/p>
<p>Are these variables just the result of some sort of transpilation?</p>
<p>Also, I can&#39;t seem to find any information regarding this and I&#39;=
ve searched pretty heavily. I know that JSON is an option for input in a wa=
y, although most of the references I can seem to find about this seem to im=
ply that people are using an XSLT stylesheet to dictate how to translate JS=
ON to XML or vice-versa.</p>
<p>What I want to do is a little different; I want to provide the input dat=
a for an XSLT template that would normally be XML, as JSON instead. My XSLT=
stylesheets are basically webpage templates with the XML input being the d=
ata to fill them out. Now that my system is all on node, I feel like I&#39;=
m doing a needless step converting my data from JSON-&gt;XML before transla=
ting it, I&#39;d like to be able to just use JSON as input but I haven&#39;=
t had any luck by setting sourceType: &#39;json&#39; in the .transform({opt=
ions})..? If this is possible is there somewhere I can find some better doc=
s on it?</p>
<p>I feel like there&#39;s potentially more functionality available in Saso=
nJS too that&#39;s not as well documented; I would love to see the document=
ation improved perhaps.</p>
<p>Previously my web platform used PHP and XSLT templates for just about ev=
erything; it seems time to perhaps use Node instead and SaxonJS seems to be=
my best bet for templates and so far it&#39;s mostly working great, althou=
gh there&#39;s a few oddities I haven&#39;t figured out, I will likely post=
in the forum now that I&#39;m signed up.</p>


<div><div></div></div>

</td></tr>
<tr><td style=3D"font-size:0.8em;width:100%;border:none;padding:0px"><hr st=
yle=3D"width:100%;height:1px;background:rgb(204,204,204);border:0px;margin:=
1.2em 0px"><p>You have received this notification because you have either s=
ubscribed to or are involved in a project on Saxonica Developer Community s=
ite.
To change your notification preferences, please click here: <a href=3D"http=
s://saxonica.plan.io/my/account?tour=3Dmail_preferences" style=3D"color:rgb=
(0,136,183)" target=3D"_blank">https://saxonica.plan.io/my/account?tour=3Dm=
ail_preferences</a></p></td></tr>
<tr><td style=3D"text-align:center;width:100%;font-family:MarketWeb,Helveti=
ca,Arial,sans-serif;font-size:1.2em;color:rgb(215,215,215);border:none;padd=
ing:0px"><br><div><a href=3D"https://plan.io/" style=3D"color:rgb(215,215,2=
15);text-decoration:none" target=3D"_blank">This notification was cheerfull=
y delivered by</a></div></td></tr>
<tr><td style=3D"text-align:center;width:100%;border:none;padding:0px"><a h=
ref=3D"https://plan.io/" title=3D"Planio" style=3D"color:rgb(0,136,183)" ta=
rget=3D"_blank"><img src=3D"https://assets.plan.io/images/planio_logo_gray_=
204x50.png" height=3D"25" width=3D"102" border=3D"0" alt=3D"Planio" style=
=3D"vertical-align: middle; border: none;"></a></td></tr>
</tbody></table>
</div>

</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
class=3D"gmail_signature"><div dir=3D"ltr"><div>Cheers,</div><div>Jai<br><=
/div></div></div>

--000000000000b3d08905dfb68422--
    (1-1/1)