GNOME Bugzilla – Bug 734224
Make xsltCopyTree public
Last modified: 2021-07-05 10:59:19 UTC
I'd like to accomplish what is described here: http://stackoverflow.com/questions/23657458/xsl-to-produce-mixed-xml-text-output i.e. shortly: 1. input is XML 2. convert using XSL to a different syntax (non-XML) 3. copy an XML sub-tree verbatim to the output With standard XSLT I could not find a way and suppose it is just not possible. So I wrote a fairly simple custom extension module which introduces a new XSL formatting command. In my actual XSL doc I call that command and it performs the verbatim copy as needed in step 3 above. The extension module contains besides the loading/unloading logic the actual processing function (like "xsltExtElementTgePluginToText"), which in turn: - copies the input node - processing quoting All of this is fine, but (here is the actual enhancement :-) I have used the function xsltCopyTree() which actually is non-public. When looking into the libxslt sources, at least on UX builds it *is* public, just not in the include files, so I just wrote my own function prototype and everything worked. On Windows I had to rebuild the DLL to really make the function xsltCopyTree() public. I don't know whether there are any other use cases for this function, but on the other hand I could not see any harm in making it public ... If desired, I'm happy to supply my extension module code as sample ... Rgds, tge
Something like this ? Daniel diff --git a/libxslt/transform.c b/libxslt/transform.c index 07b4e5c..4dffe66 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -758,9 +758,6 @@ xsltFreeTransformContext(xsltTransformContextPtr ctxt) { * * ************************************************************************/ -xmlNodePtr xsltCopyTree(xsltTransformContextPtr ctxt, - xmlNodePtr node, xmlNodePtr insert, int literal); - /** * xsltAddChild: * @parent: the parent node diff --git a/libxslt/transform.h b/libxslt/transform.h index 2cfbec2..99f03c2 100644 --- a/libxslt/transform.h +++ b/libxslt/transform.h @@ -181,6 +181,12 @@ XSLTPUBFUN xmlNodePtr XSLTCALL const xmlChar *string, int noescape); +XSLTPUBFUN xmlNodePtr XSLTCALL + xsltCopyTree (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr insert, + int literal); + /* Following 2 functions needed for libexslt/functions.c */ XSLTPUBFUN void XSLTCALL xsltLocalVariablePop (xsltTransformContextPtr ctxt,
Excellent! Many thx (+ sorry for the delay)!! tge
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxslt/-/issues/ Thank you for your understanding and your help.