Re: [xslt] xsltApplyStylesheet and xsltSaveResultTo




Would it be advisable to use xsltSaveResultTo, then, instead of xmlSaveFileTo,
even though I've changed the intermediate tree?

Thank you very much for the quick response.  You have done some very nice work
here!




Daniel Veillard <veillard@redhat.com> on 01/14/2002 04:14:13 PM

Please respond to xslt@gnome.org

To:   xslt@gnome.org
cc:    (bcc: Dave Guerrieri/Jeppesen/TMC)

Subject:  Re: [xslt] xsltApplyStylesheet and xsltSaveResultTo




On Mon, Jan 14, 2002 at 04:02:58PM -0800, Dave Guerrieri wrote:
>
>
> I would like to add the resulting node set of an XSLT tranformation to the end
> of an XML document.  The transformation happens to do some accounting work
> summing up numbers of elements, etc.  Can I do this with the result from
> xsltApplyStylesheet?  For example, can I use something like this:
>
> doc = xmlParseMemory(buffer, len);
> cur = xsltParseStylesheetFile(stylesheet_path);
> res = xsltApplyStylesheet(cur, doc, NULL);
> fragNode = xmlNewDocFragment(res);
> docRoot = xmlDocGetRootElement(doc);
> xmlAddChild(docRoot, fragNode);
> xmlSaveFile(filename,docRoot);
>
> It seems like something like this should work,

  yes though there is a lot of other stuff needed for example to
deallocate the right parts and such, but yes something like this should
work ...

> but I am thrown by the fact that
> xsltSaveResultTo needs the stylesheet again.  If all xsltSaveResultTo was
doing
> was outputting the resulting transformed tree, why would it need the
stylesheet?

  Because a number of parameters of XSLT stylesheets releated to the
serialization are not representable in the intermediate tree, like
the xsl:output parameters.

Daniel

--
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt@gnome.org
http://mail.gnome.org/mailman/listinfo/xslt









[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]