Re: [xslt] output method="text" in C program



First of all, you probably need to take a look at xsltSaveResultTo* functions from http://xmlsoft.org/XSLT/html/libxslt-xsltutils.html.

Second of all there is xmlXPathCastNodeToString function to extract text content. But I guess xsltSaveResultTo* are all you need.


On Fri, Aug 9, 2013 at 12:22 PM, Martin Gürtler <martin guertler gmx de> wrote:
Hi,

(this is my first mailing to this list; I have been using libxml and libxslt for
less than a year)

I am desperately trying to apply an xslt that is supposed to produce text and
not xml.

The transformation works with xsltproc(.exe) as expected, which suggests the
stylesheet is OK.

I wonder how to apply the transformation in a C program. For xml output, I have
been using successfully xsltApplyStylesheet, but this is supposed to produce
xml, as the result is an xmlNodePtr. What would be the correct way to either get
a char-Buffer or produce an ouput file directly? I could change the output
method to xml and read the content of the root element, but I guess there is a
better way.

Looking at xsltproc.c, there seem (at first glance) no special provisions
required for text output. Unfortunately, if I use xsltApplyStylesheet naively
(as it works with output method="xml") , the application crashes.

Any enlightenment is highly appreciated,

Martin
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt gnome org
https://mail.gnome.org/mailman/listinfo/xslt



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