After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734224 - Make xsltCopyTree public
Make xsltCopyTree public
Status: RESOLVED OBSOLETE
Product: libxslt
Classification: Platform
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-04 10:04 UTC by tge
Modified: 2021-07-05 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description tge 2014-08-04 10:04:25 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
Comment 1 Daniel Veillard 2014-08-05 09:24:21 UTC
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,
Comment 2 tge 2014-08-11 17:46:43 UTC
Excellent!

Many thx (+ sorry for the delay)!!
  tge
Comment 3 GNOME Infrastructure Team 2021-07-05 10:59:19 UTC
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.