Extension Function Implementation
Андрей Олешкевич via xslt <[email protected]> Tue, 5 Oct 2021 13:30:00 +0300
| Newsgroups | gmane.comp.gnome.lib.xslt |
|---|---|
| Message-ID | <CAF25rrKbEoqcfyGCq8dr+6dStC=d5J5cd5vEDfyZ6UUb3=DgWg@mail.gmail.com> |
--===============2341731675467244582==
Content-Type: multipart/alternative; boundary="000000000000a74fd905cd98834f"
--000000000000a74fd905cd98834f
Content-Type: text/plain; charset="UTF-8"
I am trying to create an xslt extension function for libxslt (c++). My
extension function takes a string as input, then this string is parsed by
xml parser, and the function returns this parsed xml. I return value by
this expression:
void fnParse(xmlXPathParserContextPtr ctx, int nargs) { ...
xmlXPathReturnNodeSet(ctx, xmlXPathNodeSetCreate(node)); }
But I have found that libxslt does not free node memory after use. It free
xmlNodeSet, but not free the node which is stored in this nodeset. Perhaps
I missed something important. What is the correct way to return an XML node
in the extension function?
--000000000000a74fd905cd98834f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><span style=3D"font-family:"Source Sans Pro",Can=
tarell,"Droid Sans",Ubuntu,"DejaVu Sans",Arial,sans-ser=
if;font-size:15.008px">I am trying to create an xslt extension function for=
libxslt (c++). My extension function takes a string as input, then this st=
ring is parsed by xml parser, and the function returns this parsed xml. I r=
eturn value by this expression:</span><br><div><span style=3D"font-family:C=
onsolas,Menlo,Monaco,"Lucida Console","Liberation Mono"=
,"DejaVu Sans Mono","Bitstream Vera Sans Mono","Co=
urier New",monospace;font-size:15.008px;white-space:pre;background-col=
or:rgb(249,249,249)"><br></span></div><div><span style=3D"font-family:Conso=
las,Menlo,Monaco,"Lucida Console","Liberation Mono",&qu=
ot;DejaVu Sans Mono","Bitstream Vera Sans Mono","Courie=
r New",monospace;font-size:15.008px;white-space:pre;background-color:r=
gb(249,249,249)">void fnParse(xmlXPathParserContextPtr ctx, int nargs)
{
...
xmlXPathReturnNodeSet(ctx, xmlXPathNodeSetCreate(node));
}</span><span style=3D"font-family:"Source Sans Pro",Cantarell,&q=
uot;Droid Sans",Ubuntu,"DejaVu Sans",Arial,sans-serif;font-s=
ize:15.008px"><br></span></div><div><span style=3D"font-family:Consolas,Men=
lo,Monaco,"Lucida Console","Liberation Mono","Deja=
Vu Sans Mono","Bitstream Vera Sans Mono","Courier New&q=
uot;,monospace;font-size:15.008px;white-space:pre;background-color:rgb(249,=
249,249)"><br></span></div><div><span style=3D"font-family:"Source San=
s Pro",Cantarell,"Droid Sans",Ubuntu,"DejaVu Sans"=
,Arial,sans-serif;font-size:15.008px">But I have found that libxslt does no=
t free node memory after use. It free xmlNodeSet, but not free the node whi=
ch is stored in this nodeset. Perhaps I missed something important. What is=
the correct way to return an XML node in the extension function?</span>=C2=
=A0=C2=A0<span style=3D"font-family:Consolas,Menlo,Monaco,"Lucida Cons=
ole","Liberation Mono","DejaVu Sans Mono","Bi=
tstream Vera Sans Mono","Courier New",monospace;font-size:15=
.008px;white-space:pre;background-color:rgb(249,249,249)"><br></span></div>=
</div>
--000000000000a74fd905cd98834f--
--===============2341731675467244582==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
https://mail.gnome.org/mailman/listinfo/xslt
--===============2341731675467244582==--