Re: XdmValue objects returned from applyTemplates()
Alan Painter <[email protected]> Sat, 7 Aug 2021 00:47:26 +0200
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <CAN+GtW29jaQ58VwTzpPs3DKjphst0tVz3z0CcaqwYS=qLCg-UA@mail.gmail.com> |
--===============2366486984679311281==
Content-Type: multipart/alternative; boundary="0000000000007221bd05c8ebd22e"
--0000000000007221bd05c8ebd22e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
It appears to me that, in my usages, there are three main categories of
XdmValue "types" that one would see as a result of an XSLT transformation
(either principal output or result-document output):
a) Plain ol' XML
b) Maps/Array/Atomics (or what I was calling "JSON-oriented")
c) Maps/Arrays containing XML data
So if I want to feed the XdmValue output from apply-templates() as the
input selection to apply-templates() of a different processor, I'll need to
(respectively)
a) Use NamePoolConverter
b) No conversion necessary
c) Pretty substantial undertaking
a) and b) seem to work using this converter:
private static XdmValue convertXdmValueForXslt(final XdmValue
toConvert, final Xslt30Transformer destinationXslt) throws
XPathException {
if ( !(toConvert instanceof XdmNode) ) {
// not XML hence don't convert
return toConvert;
}
final RawDestination rawDest =3D new RawDestination();
final PipelineConfiguration pipe =3D
destinationXslt.getUnderlyingController().makePipelineConfiguration();
final Receiver receiver =3D rawDest.getReceiver(pipe, null=
);
Sender.send((NodeInfo) toConvert.getUnderlyingValue(), receiver,
new ParseOptions());
return rawDest.getXdmValue();
}
c) would require that substantial undertaking so I will think about that
later as may not even be very useful
I did try a test to see what errors that I would get by transforming maps
containing XML. To create this, I used the adaptive output method:
<xsl:stylesheet xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
version=3D"3.0"
exclude-result-prefixes=3D"xsl">
<xsl:output method=3D"adaptive" indent=3D"yes"/>
<xsl:template match=3D".">
<xsl:map>
<xsl:map-entry key=3D"'anArray'" select=3D"array { 1, 2,
3.14159, (), true(), 'anArray' }" />
<xsl:map-entry key=3D"'someXml'">
<here is=3D"some" >
<xml>data</xml>
</here>
</xsl:map-entry>
<xsl:map-entry key=3D"'anotherMap'">
<xsl:map-entry key=3D"'key1'" select=3D"'value1'" />
<xsl:map-entry key=3D"'key2'" select=3D"[ 10, 9, 8 ]" />
</xsl:map-entry>
</xsl:map>
</xsl:template>
</xsl:stylesheet>
I used the output of this transformation as the input to an identity
transformation of a different processor:
<xsl:stylesheet xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
version=3D"3.0"
exclude-result-prefixes=3D"xsl">
<xsl:output method=3D"adaptive" indent=3D"yes"/>
<xsl:template match=3D".">
<xsl:copy-of select=3D"." />
</xsl:template>
</xsl:stylesheet>
I didn't encounter any errors in the processing, although I understand
that this doesn't mean that it would always work.
So it does seem that for maps/arrays containing XML, the embedded XML
configurations are not checked for compatibility with the processor's
configuration.
I do think that I'm getting somewhere. Thanks again for your help.
-alan
On Thu, Aug 5, 2021 at 12:41 AM Michael Kay <mike-JkSD5nQpfvpWk0Htik3J/[email protected]> wrote:
> Depends a bit what you mean by =E2=80=9CJSON-oriented=E2=80=9D. Maps and =
arrays can of
> course contain XDM nodes in their values (and I don=E2=80=99t think we al=
ways check
> that these belong to the right Configuration when supplied via external
> APIs, in the same way that we check for nodes). Writing code that convert=
s
> a map-containing-nodes from one Configuration to a
> map-containing-equivalent-nodes from a different Configuration would be a
> pretty substantial undertaking.
>
>
>
> Sender.send() expects a Source object, and the JAXP Source interface is
> very XML-biased.
>
>
>
> Michael Kay
>
> Saxonica
>
>
>
> *From: *Alan Painter <[email protected]>
> *Sent: *04 August 2021 22:33
> *To: *Mailing list for the SAXON XSLT and XQuery processor
> <[email protected]>
> *Subject: *Re: [saxon] XdmValue objects returned from applyTemplates()
>
>
>
> I see that I was too hasty in saying that it was "working" for me.
>
>
>
> I'd like the XdmValue to be any arbitrary Xdm with un-annotated XML, maps=
,
> arrays and atomics (no need for functions).
>
> But maps and and arrays cannot be cast to NodeInfo (or, at least, I'm
> getting an error when doing this).
>
>
>
> Would there be a way to send JSON-oriented XdmValue to Sender.send()?
>
> (I'm thinking that a pure JSON XdmValue wouldn't need to have its NamePoo=
l
> converted, but what about a mix of XML and maps/arrays?)
>
>
>
> thanks again for any help
>
>
>
>
>
>
>
> On Wed, Aug 4, 2021 at 10:12 PM Alan Painter <[email protected]>
> wrote:
>
> I'm finally getting around to implementing something w.r.t. the pointers
> that you gave me, Michael.
>
>
>
> My objective is to convert a given XdmValue so that it can become the
> input for a Xslt30Transformer with a different NamePool from the origin
> Xslt30Transformer.
>
>
>
> This seems to be working for me. I'm curious if this is OK and if there
> isn't a shorter way.
>
>
>
> *private *XdmValue convertXdmValueForXslt(*final *XdmValue toConvert, *fi=
nal *Xslt30Transformer destinationXslt) *throws *XPathException {
> *final *RawDestination rawDest =3D *new *RawDestination();
> *final *PipelineConfiguration pipe =3D destinationXslt.getUnderly=
ingController().makePipelineConfiguration();
> *final *Receiver receiver =3D rawDest.getReceiver(pipe, =
*null*);
>
> Sender.*send*((NodeInfo) toConvert.getUnderlyingValue(), receiver, *n=
ew *ParseOptions());
>
> *return *rawDest.getXdmValue();
> }
>
>
>
> Thanks again for the help
>
>
>
> best regards
>
>
>
> -alan
>
>
>
> On Thu, Jul 15, 2021 at 1:18 AM Michael Kay <[email protected]>
> wrote:
>
> >I'm wondering what the drawbacks would be for re-using a same Processor
> by a (potentially) large number of Xslt30Transformers in parallel.
>
> For most cases, none.
>
> Potentially you could hit limits on the number of names allowed in a
> NamePool. In practice we never see people hitting those limits.
>
> Slightly more likely is that you hit a problem that the schema components
> held by a Processor must be consistent (for example, you can't have two
> different types with the same name - which could happen if you want to us=
e
> two different versions of the same schema).
>
> In general, you should only create a single Processor unless you have
> clear reasons to do otherwise.
>
> There is in fact a low-level mechanism to copy an XdmNode owned by one
> Processor to a different Processor: it's the NamePoolConverter class, use=
d
> by the method Sender.sendDocumentInfo(). But it's not exposed in a
> convenient way at the s9api interface.
>
> Michael Kay
> Saxonica
>
>
>
>
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
--0000000000007221bd05c8ebd22e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">It appears to me that, in my usages, there are three main =
categories of XdmValue "types" that one would see as a result of =
an XSLT transformation (either principal output or result-document output):=
<div><br></div><div>a) Plain ol' XML</div><div>b) Maps/Array/Atomics (o=
r what I was calling "JSON-oriented")</div><div>c) Maps/Arrays co=
ntaining XML data</div><div><br></div><div>So if I want to feed the XdmValu=
e output from apply-templates() as the input selection to apply-templates()=
of a different processor, I'll need to (respectively)</div><div><br></=
div><div>a) Use NamePoolConverter=C2=A0</div><div>b) No conversion necessar=
y</div><div>c) Pretty substantial undertaking=C2=A0</div><div><br></div><di=
v>a) and b) seem to work using this converter:</div><div><pre style=3D"colo=
r:rgb(0,0,0);font-family:Menlo;font-size:9pt"><span style=3D"color:rgb(0,0,=
128);font-weight:bold">private static </span>XdmValue convertXdmValueForXsl=
t(<span style=3D"color:rgb(0,0,128);font-weight:bold">final </span>XdmValue=
toConvert, <span style=3D"color:rgb(0,0,128);font-weight:bold">final </spa=
n>Xslt30Transformer destinationXslt) <span style=3D"color:rgb(0,0,128);font=
-weight:bold">throws </span>XPathException {<br><br> <span style=3D"colo=
r:rgb(0,0,128);font-weight:bold">if </span>( !(toConvert <span style=3D"col=
or:rgb(0,0,128);font-weight:bold">instanceof </span>XdmNode) ) {<br> =
<span style=3D"color:rgb(128,128,128);font-style:italic">// not XML hence =
don't convert<br></span><span style=3D"color:rgb(128,128,128);font-styl=
e:italic"> </span><span style=3D"color:rgb(0,0,128);font-weight:bold=
">return </span>toConvert;<br> }<br><br> <span style=3D"color:rgb(0,0=
,128);font-weight:bold">final </span>RawDestination rawDest =3D <sp=
an style=3D"color:rgb(0,0,128);font-weight:bold">new </span>RawDestination(=
);<br> <span style=3D"color:rgb(0,0,128);font-weight:bold">final </span>=
PipelineConfiguration pipe =3D destinationXslt.getUnderlyingController(=
).makePipelineConfiguration();<br> <span style=3D"color:rgb(0,0,128);fon=
t-weight:bold">final </span>Receiver receiver =3D rawDest.getR=
eceiver(pipe, <span style=3D"color:rgb(0,0,128);font-weight:bold">null</spa=
n>);<br><br> Sender.<span style=3D"font-style:italic">send</span>((NodeI=
nfo) toConvert.getUnderlyingValue(), receiver, <span style=3D"color:rgb(0,0=
,128);font-weight:bold">new </span>ParseOptions());<br><br> <span style=
=3D"color:rgb(0,0,128);font-weight:bold">return </span>rawDest.getXdmValue(=
);<br>}</pre></div><div>c) would require that substantial undertaking so I =
will think about that later as may not even be very useful</div><div><br></=
div><div>I did try a test to see what errors that I would get by transformi=
ng maps containing XML.=C2=A0 To create this, I used the adaptive output me=
thod:</div><div><pre style=3D"color:rgb(0,0,0);font-family:Menlo;font-size:=
9pt"><span style=3D"background-color:rgb(247,250,255)"><</span><span sty=
le=3D"color:rgb(0,0,128);background-color:rgb(247,250,255);font-weight:bold=
">xsl:stylesheet </span><span style=3D"color:rgb(0,0,255);background-color:=
rgb(247,250,255);font-weight:bold">xmlns:xsl</span><span style=3D"color:rgb=
(0,128,0);background-color:rgb(247,250,255);font-weight:bold">=3D"<a h=
ref=3D"http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Tra=
nsform</a>"<br></span><span style=3D"color:rgb(0,128,0);background-col=
or:rgb(247,250,255);font-weight:bold"> </span><span style=3D"color:rgb(0,0=
,255);background-color:rgb(247,250,255);font-weight:bold">version</span><sp=
an style=3D"color:rgb(0,128,0);background-color:rgb(247,250,255);font-weigh=
t:bold">=3D"3.0"<br></span><span style=3D"color:rgb(0,128,0);back=
ground-color:rgb(247,250,255);font-weight:bold"> </span><span style=3D"col=
or:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:bold">exclude=
-result-prefixes</span><span style=3D"color:rgb(0,128,0);background-color:r=
gb(247,250,255);font-weight:bold">=3D"xsl"</span><span style=3D"b=
ackground-color:rgb(247,250,255)">></span><br><br> <span style=3D"backg=
round-color:rgb(247,250,255)"><</span><span style=3D"color:rgb(0,0,128);=
background-color:rgb(247,250,255);font-weight:bold">xsl:output </span><span=
style=3D"color:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:=
bold">method</span><span style=3D"color:rgb(0,128,0);background-color:rgb(2=
47,250,255);font-weight:bold">=3D"adaptive" </span><span style=3D=
"color:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:bold">ind=
ent</span><span style=3D"color:rgb(0,128,0);background-color:rgb(247,250,25=
5);font-weight:bold">=3D"yes"</span><span style=3D"background-col=
or:rgb(247,250,255)">/></span><br><br> <span style=3D"background-color:=
rgb(247,250,255)"><</span><span style=3D"color:rgb(0,0,128);background-c=
olor:rgb(247,250,255);font-weight:bold">xsl:template </span><span style=3D"=
color:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:bold">matc=
h</span><span style=3D"color:rgb(0,128,0);background-color:rgb(247,250,255)=
;font-weight:bold">=3D"."</span><span style=3D"background-color:r=
gb(247,250,255)">></span><br> <span style=3D"background-color:rgb(2=
47,250,255)"><</span><span style=3D"color:rgb(0,0,128);background-color:=
rgb(247,250,255);font-weight:bold">xsl:map</span><span style=3D"background-=
color:rgb(247,250,255)">></span><br> <span style=3D"background-=
color:rgb(247,250,255)"><</span><span style=3D"color:rgb(0,0,128);backgr=
ound-color:rgb(247,250,255);font-weight:bold">xsl:map-entry </span><span st=
yle=3D"color:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:bol=
d">key</span><span style=3D"color:rgb(0,128,0);background-color:rgb(247,250=
,255);font-weight:bold">=3D"'anArray'" </span><span style=
=3D"color:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:bold">=
select</span><span style=3D"color:rgb(0,128,0);background-color:rgb(247,250=
,255);font-weight:bold">=3D"array { 1, 2, 3.14159, (), true(), 'an=
Array' }" </span><span style=3D"background-color:rgb(247,250,255)"=
>/></span><br> <span style=3D"background-color:rgb(247,250,255)=
"><</span><span style=3D"color:rgb(0,0,128);background-color:rgb(247,250=
,255);font-weight:bold">xsl:map-entry </span><span style=3D"color:rgb(0,0,2=
55);background-color:rgb(247,250,255);font-weight:bold">key</span><span sty=
le=3D"color:rgb(0,128,0);background-color:rgb(247,250,255);font-weight:bold=
">=3D"'someXml'"</span><span style=3D"background-color:rg=
b(247,250,255)">></span><br> <span style=3D"background-color:=
rgb(239,239,239)"><</span><span style=3D"color:rgb(0,0,128);background-c=
olor:rgb(239,239,239);font-weight:bold">here </span><span style=3D"color:rg=
b(0,0,255);background-color:rgb(239,239,239);font-weight:bold">is</span><sp=
an style=3D"color:rgb(0,128,0);background-color:rgb(239,239,239);font-weigh=
t:bold">=3D"some" </span><span style=3D"background-color:rgb(239,=
239,239)">></span><br> <span style=3D"background-color:rgb(=
239,239,239)"><</span><span style=3D"color:rgb(0,0,128);background-color=
:rgb(239,239,239);font-weight:bold">xml</span><span style=3D"background-col=
or:rgb(239,239,239)">></span>data<span style=3D"background-color:rgb(239=
,239,239)"></</span><span style=3D"color:rgb(0,0,128);background-color:r=
gb(239,239,239);font-weight:bold">xml</span><span style=3D"background-color=
:rgb(239,239,239)">></span><br> <span style=3D"background-col=
or:rgb(239,239,239)"></</span><span style=3D"color:rgb(0,0,128);backgrou=
nd-color:rgb(239,239,239);font-weight:bold">here</span><span style=3D"backg=
round-color:rgb(239,239,239)">></span><br> <span style=3D"backg=
round-color:rgb(247,250,255)"></</span><span style=3D"color:rgb(0,0,128)=
;background-color:rgb(247,250,255);font-weight:bold">xsl:map-entry</span><s=
pan style=3D"background-color:rgb(247,250,255)">></span><br> <s=
pan style=3D"background-color:rgb(247,250,255)"><</span><span style=3D"c=
olor:rgb(0,0,128);background-color:rgb(247,250,255);font-weight:bold">xsl:m=
ap-entry </span><span style=3D"color:rgb(0,0,255);background-color:rgb(247,=
250,255);font-weight:bold">key</span><span style=3D"color:rgb(0,128,0);back=
ground-color:rgb(247,250,255);font-weight:bold">=3D"'anotherMap=
9;"</span><span style=3D"background-color:rgb(247,250,255)">></span=
><br> <span style=3D"background-color:rgb(247,250,255)"><</sp=
an><span style=3D"color:rgb(0,0,128);background-color:rgb(247,250,255);font=
-weight:bold">xsl:map-entry </span><span style=3D"color:rgb(0,0,255);backgr=
ound-color:rgb(247,250,255);font-weight:bold">key</span><span style=3D"colo=
r:rgb(0,128,0);background-color:rgb(247,250,255);font-weight:bold">=3D"=
;'key1'" </span><span style=3D"color:rgb(0,0,255);background-c=
olor:rgb(247,250,255);font-weight:bold">select</span><span style=3D"color:r=
gb(0,128,0);background-color:rgb(247,250,255);font-weight:bold">=3D"&#=
39;value1'" </span><span style=3D"background-color:rgb(247,250,255=
)">/></span><br> <span style=3D"background-color:rgb(247,250,=
255)"><</span><span style=3D"color:rgb(0,0,128);background-color:rgb(247=
,250,255);font-weight:bold">xsl:map-entry </span><span style=3D"color:rgb(0=
,0,255);background-color:rgb(247,250,255);font-weight:bold">key</span><span=
style=3D"color:rgb(0,128,0);background-color:rgb(247,250,255);font-weight:=
bold">=3D"'key2'" </span><span style=3D"color:rgb(0,0,255=
);background-color:rgb(247,250,255);font-weight:bold">select</span><span st=
yle=3D"color:rgb(0,128,0);background-color:rgb(247,250,255);font-weight:bol=
d">=3D"[ 10, 9, 8 ]" </span><span style=3D"background-color:rgb(2=
47,250,255)">/></span><br> <span style=3D"background-color:rgb(=
247,250,255)"></</span><span style=3D"color:rgb(0,0,128);background-colo=
r:rgb(247,250,255);font-weight:bold">xsl:map-entry</span><span style=3D"bac=
kground-color:rgb(247,250,255)">></span><br> <span style=3D"backgro=
und-color:rgb(247,250,255)"></</span><span style=3D"color:rgb(0,0,128);b=
ackground-color:rgb(247,250,255);font-weight:bold">xsl:map</span><span styl=
e=3D"background-color:rgb(247,250,255)">></span><br> <span style=3D"bac=
kground-color:rgb(247,250,255)"></</span><span style=3D"color:rgb(0,0,12=
8);background-color:rgb(247,250,255);font-weight:bold">xsl:template</span><=
span style=3D"background-color:rgb(247,250,255)">></span><br><span style=
=3D"background-color:rgb(247,250,255)"></</span><span style=3D"color:rgb=
(0,0,128);background-color:rgb(247,250,255);font-weight:bold">xsl:styleshee=
t</span><span style=3D"background-color:rgb(247,250,255)">></span></pre>=
<pre style=3D"color:rgb(0,0,0);font-family:Menlo;font-size:9pt"><span style=
=3D"font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,=
34)">I used the=C2=A0output of this transformation as the input to an ident=
ity transformation of a different processor:</span></pre><pre style=3D"colo=
r:rgb(0,0,0);font-family:Menlo;font-size:9pt"><pre style=3D"font-family:Men=
lo;font-size:9pt"><span style=3D"background-color:rgb(247,250,255)"><</s=
pan><span style=3D"color:rgb(0,0,128);background-color:rgb(247,250,255);fon=
t-weight:bold">xsl:stylesheet </span><span style=3D"color:rgb(0,0,255);back=
ground-color:rgb(247,250,255);font-weight:bold">xmlns:xsl</span><span style=
=3D"color:rgb(0,128,0);background-color:rgb(247,250,255);font-weight:bold">=
=3D"<a href=3D"http://www.w3.org/1999/XSL/Transform">http://www.w3.org=
/1999/XSL/Transform</a>"<br></span><span style=3D"color:rgb(0,128,0);b=
ackground-color:rgb(247,250,255);font-weight:bold"> </span><span style=3D"=
color:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:bold">vers=
ion</span><span style=3D"color:rgb(0,128,0);background-color:rgb(247,250,25=
5);font-weight:bold">=3D"3.0"<br></span><span style=3D"color:rgb(=
0,128,0);background-color:rgb(247,250,255);font-weight:bold"> </span><span=
style=3D"color:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:=
bold">exclude-result-prefixes</span><span style=3D"color:rgb(0,128,0);backg=
round-color:rgb(247,250,255);font-weight:bold">=3D"xsl"</span><sp=
an style=3D"background-color:rgb(247,250,255)">></span><br><br> <span s=
tyle=3D"background-color:rgb(247,250,255)"><</span><span style=3D"color:=
rgb(0,0,128);background-color:rgb(247,250,255);font-weight:bold">xsl:output=
</span><span style=3D"color:rgb(0,0,255);background-color:rgb(247,250,255)=
;font-weight:bold">method</span><span style=3D"color:rgb(0,128,0);backgroun=
d-color:rgb(247,250,255);font-weight:bold">=3D"adaptive" </span><=
span style=3D"color:rgb(0,0,255);background-color:rgb(247,250,255);font-wei=
ght:bold">indent</span><span style=3D"color:rgb(0,128,0);background-color:r=
gb(247,250,255);font-weight:bold">=3D"yes"</span><span style=3D"b=
ackground-color:rgb(247,250,255)">/></span><br><br> <span style=3D"back=
ground-color:rgb(247,250,255)"><</span><span style=3D"color:rgb(0,0,128)=
;background-color:rgb(247,250,255);font-weight:bold">xsl:template </span><s=
pan style=3D"color:rgb(0,0,255);background-color:rgb(247,250,255);font-weig=
ht:bold">match</span><span style=3D"color:rgb(0,128,0);background-color:rgb=
(247,250,255);font-weight:bold">=3D"."</span><span style=3D"backg=
round-color:rgb(247,250,255)">></span><br> <span style=3D"backgroun=
d-color:rgb(247,250,255)"><</span><span style=3D"color:rgb(0,0,128);back=
ground-color:rgb(247,250,255);font-weight:bold">xsl:copy-of </span><span st=
yle=3D"color:rgb(0,0,255);background-color:rgb(247,250,255);font-weight:bol=
d">select</span><span style=3D"color:rgb(0,128,0);background-color:rgb(247,=
250,255);font-weight:bold">=3D"." </span><span style=3D"backgroun=
d-color:rgb(247,250,255)">/></span><br> <span style=3D"background-color=
:rgb(247,250,255)"></</span><span style=3D"color:rgb(0,0,128);background=
-color:rgb(247,250,255);font-weight:bold">xsl:template</span><span style=3D=
"background-color:rgb(247,250,255)">></span><br><br><span style=3D"backg=
round-color:rgb(247,250,255)"></</span><span style=3D"color:rgb(0,0,128)=
;background-color:rgb(247,250,255);font-weight:bold">xsl:stylesheet</span><=
span style=3D"background-color:rgb(247,250,255)">></span></pre></pre><pr=
e style=3D"color:rgb(0,0,0);font-family:Menlo;font-size:9pt"><span style=3D=
"font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)=
">I didn't encounter any errors in the processing, although I understan=
d that this doesn't mean that it would always work.</span></pre><pre st=
yle=3D"color:rgb(0,0,0);font-family:Menlo;font-size:9pt"><span style=3D"col=
or:rgb(34,34,34);font-family:Arial,Helvetica,sans-serif;font-size:small">So=
it does seem that for maps/arrays containing XML, the embedded XML configu=
rations are not checked for compatibility with the processor's configur=
ation.</span><br></pre><pre style=3D"color:rgb(0,0,0);font-family:Menlo;fon=
t-size:9pt"><span style=3D"color:rgb(34,34,34);font-family:Arial,Helvetica,=
sans-serif;font-size:small">I do think that I'm getting somewhere. Tha=
nks again for your help.</span></pre><pre style=3D"color:rgb(0,0,0);font-fa=
mily:Menlo;font-size:9pt">-alan</pre><pre style=3D"color:rgb(0,0,0);font-fa=
mily:Menlo;font-size:9pt"><br></pre><pre style=3D"color:rgb(0,0,0);font-fam=
ily:Menlo;font-size:9pt"><span style=3D"font-family:Arial,Helvetica,sans-se=
rif;font-size:small;color:rgb(34,34,34)"><br></span></pre><pre style=3D"col=
or:rgb(0,0,0);font-family:Menlo;font-size:9pt"><span style=3D"font-family:A=
rial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"><br></span><=
/pre></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"g=
mail_attr">On Thu, Aug 5, 2021 at 12:41 AM Michael Kay <<a href=3D"mailt=
o:mike-JkSD5nQpfvpWk0Htik3J/[email protected]">mike-JkSD5nQpfvpWk0Htik3J/[email protected]</a>> wrote:<br></div><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol=
id rgb(204,204,204);padding-left:1ex"><div lang=3D"EN-GB" style=3D"overflow=
-wrap: break-word;"><div class=3D"gmail-m_-876889316942839831WordSection1">=
<p class=3D"MsoNormal">Depends a bit what you mean by =E2=80=9CJSON-oriente=
d=E2=80=9D. Maps and arrays can of course contain XDM nodes in their values=
(and I don=E2=80=99t think we always check that these belong to the right =
Configuration when supplied via external APIs, in the same way that we chec=
k for nodes). Writing code that converts a map-containing-nodes from one Co=
nfiguration to a map-containing-equivalent-nodes from a different Configura=
tion would be a pretty substantial undertaking.</p><p class=3D"MsoNormal"><=
u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">Sender.send() expects a Sourc=
e object, and the JAXP Source interface is very XML-biased.</p><p class=3D"=
MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">Michael Kay</p><p=
class=3D"MsoNormal">Saxonica</p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u=
></p><div style=3D"border-right:none;border-bottom:none;border-left:none;bo=
rder-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm"><p class=3D"MsoNor=
mal" style=3D"border:none;padding:0cm"><b>From: </b><a href=3D"mailto:alan.=
[email protected]" target=3D"_blank">Alan Painter</a><br><b>Sent: </b>04 Au=
gust 2021 22:33<br><b>To: </b><a href=3D"mailto:[email protected]=
e.net" target=3D"_blank">Mailing list for the SAXON XSLT and XQuery process=
or</a><br><b>Subject: </b>Re: [saxon] XdmValue objects returned from applyT=
emplates()</p></div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><div><p =
class=3D"MsoNormal">I see that I was too hasty in saying that it was "=
working" for me.</p><div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></=
p></div><div><p class=3D"MsoNormal">I'd like the XdmValue to be any arb=
itrary Xdm with un-annotated XML, maps, arrays and atomics (no need for fun=
ctions).=C2=A0=C2=A0</p></div><div><p class=3D"MsoNormal">But maps and and =
arrays cannot be cast to NodeInfo (or, at least, I'm getting an error w=
hen doing this).</p></div><div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u><=
/p></div><div><p class=3D"MsoNormal">Would there be a way to send JSON-orie=
nted XdmValue to Sender.send()?=C2=A0=C2=A0</p></div><div><p class=3D"MsoNo=
rmal">(I'm thinking that a pure JSON XdmValue wouldn't need to have=
its NamePool converted, but what about a mix of XML and maps/arrays?)</p><=
/div><div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p></div><div><p clas=
s=3D"MsoNormal">thanks again for any help</p></div><div><p class=3D"MsoNorm=
al"><u></u>=C2=A0<u></u></p></div><div><p class=3D"MsoNormal"><u></u>=C2=A0=
<u></u></p></div></div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><div>=
<div><p class=3D"MsoNormal">On Wed, Aug 4, 2021 at 10:12 PM Alan Painter &l=
t;<a href=3D"mailto:[email protected]" target=3D"_blank">alan.painter@=
gmail.com</a>> wrote:</p></div><blockquote style=3D"border-top:none;bord=
er-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);pad=
ding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><p class=3D"M=
soNormal">I'm finally getting around to implementing something w.r.t. t=
he pointers that you gave me, Michael.</p><div><p class=3D"MsoNormal"><u></=
u>=C2=A0<u></u></p></div><div><p class=3D"MsoNormal">My objective is to con=
vert a given XdmValue so that it can become the input for a Xslt30Transform=
er=C2=A0with a different NamePool from the origin Xslt30Transformer.</p></d=
iv><div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p></div><div><p class=
=3D"MsoNormal">This seems to be working for me.=C2=A0 I'm curious if th=
is is OK and if there isn't a shorter way.</p></div><div><p class=3D"Ms=
oNormal"><u></u>=C2=A0<u></u></p></div><div><pre><b><span style=3D"font-siz=
e:9pt;font-family:Menlo,serif;color:navy">private </span></b><span style=3D=
"font-size:9pt;font-family:Menlo,serif;color:black">XdmValue convertXdmValu=
eForXslt(</span><b><span style=3D"font-size:9pt;font-family:Menlo,serif;col=
or:navy">final </span></b><span style=3D"font-size:9pt;font-family:Menlo,se=
rif;color:black">XdmValue toConvert, </span><b><span style=3D"font-size:9pt=
;font-family:Menlo,serif;color:navy">final </span></b><span style=3D"font-s=
ize:9pt;font-family:Menlo,serif;color:black">Xslt30Transformer destinationX=
slt) </span><b><span style=3D"font-size:9pt;font-family:Menlo,serif;color:n=
avy">throws </span></b><span style=3D"font-size:9pt;font-family:Menlo,serif=
;color:black">XPathException {<br>=C2=A0=C2=A0=C2=A0 </span><b><span style=
=3D"font-size:9pt;font-family:Menlo,serif;color:navy">final </span></b><spa=
n style=3D"font-size:9pt;font-family:Menlo,serif;color:black">RawDestinatio=
n=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rawDest=C2=A0 =3D </span><b><sp=
an style=3D"font-size:9pt;font-family:Menlo,serif;color:navy">new </span></=
b><span style=3D"font-size:9pt;font-family:Menlo,serif;color:black">RawDest=
ination();<br>=C2=A0=C2=A0=C2=A0 </span><b><span style=3D"font-size:9pt;fon=
t-family:Menlo,serif;color:navy">final </span></b><span style=3D"font-size:=
9pt;font-family:Menlo,serif;color:black">PipelineConfiguration pipe=C2=A0=
=C2=A0=C2=A0=C2=A0 =3D destinationXslt.getUnderlyingController().makePipeli=
neConfiguration();<br>=C2=A0=C2=A0=C2=A0 </span><b><span style=3D"font-size=
:9pt;font-family:Menlo,serif;color:navy">final </span></b><span style=3D"fo=
nt-size:9pt;font-family:Menlo,serif;color:black">Receiver=C2=A0=C2=A0 =C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0receiver =3D=
rawDest.getReceiver(pipe, </span><b><span style=3D"font-size:9pt;font-fami=
ly:Menlo,serif;color:navy">null</span></b><span style=3D"font-size:9pt;font=
-family:Menlo,serif;color:black">);<br><br>=C2=A0=C2=A0=C2=A0 Sender.<i>sen=
d</i>((NodeInfo) toConvert.getUnderlyingValue(), receiver, </span><b><span =
style=3D"font-size:9pt;font-family:Menlo,serif;color:navy">new </span></b><=
span style=3D"font-size:9pt;font-family:Menlo,serif;color:black">ParseOptio=
ns());<br><br>=C2=A0=C2=A0=C2=A0 </span><b><span style=3D"font-size:9pt;fon=
t-family:Menlo,serif;color:navy">return </span></b><span style=3D"font-size=
:9pt;font-family:Menlo,serif;color:black">rawDest.getXdmValue();<br>}<u></u=
><u></u></span></pre></div><div><p class=3D"MsoNormal"><u></u>=C2=A0<u></u>=
</p></div><div><p class=3D"MsoNormal">Thanks again for the help</p></div><d=
iv><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p></div><div><p class=3D"Ms=
oNormal">best regards</p></div><div><p class=3D"MsoNormal"><u></u>=C2=A0<u>=
</u></p></div><div><p class=3D"MsoNormal">-alan</p></div></div><p class=3D"=
MsoNormal"><u></u>=C2=A0<u></u></p><div><div><p class=3D"MsoNormal">On Thu,=
Jul 15, 2021 at 1:18 AM Michael Kay <<a href=3D"mailto:michaelkay90@gma=
il.com" target=3D"_blank">[email protected]</a>> wrote:</p></div></=
div></blockquote></div><p class=3D"MsoNormal" style=3D"margin-left:9.6pt">&=
gt;I'm wondering what the drawbacks would be for re-using a same Proces=
sor by a (potentially) large number of Xslt30Transformers in parallel. <br>=
<br>For most cases, none.<br><br>Potentially you could hit limits on the nu=
mber of names allowed in a NamePool. In practice we never see people hittin=
g those limits.<br><br>Slightly more likely is that you hit a problem that =
the schema components held by a Processor must be consistent (for example, =
you can't have two different types with the same name - which could hap=
pen if you want to use two different versions of the same schema).<br><br>I=
n general, you should only create a single Processor unless you have clear =
reasons to do otherwise.<br><br>There is in fact a low-level mechanism to c=
opy an XdmNode owned by one Processor to a different Processor: it's th=
e NamePoolConverter class, used by the method Sender.sendDocumentInfo(). Bu=
t it's not exposed in a convenient way at the s9api interface.<br><br>M=
ichael Kay<br>Saxonica<br><br><br><br><br>_________________________________=
______________<br>saxon-help mailing list archived at <a href=3D"http://sax=
on.markmail.org/" target=3D"_blank">http://saxon.markmail.org/</a><br><a hr=
ef=3D"mailto:[email protected]" target=3D"_blank">saxon-help=
@lists.sourceforge.net</a><br><a href=3D"https://lists.sourceforge.net/list=
s/listinfo/saxon-help" target=3D"_blank">https://lists.sourceforge.net/list=
s/listinfo/saxon-help</a> </p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></=
p></div></div>_______________________________________________<br>
saxon-help mailing list archived at <a href=3D"http://saxon.markmail.org/" =
rel=3D"noreferrer" target=3D"_blank">http://saxon.markmail.org/</a><br>
<a href=3D"mailto:[email protected]" target=3D"_blank">saxon=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/saxon-help" rel=3D"=
noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/=
saxon-help</a> </blockquote></div>
--0000000000007221bd05c8ebd22e--
--===============2366486984679311281==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============2366486984679311281==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help
--===============2366486984679311281==--