Re: output method="text" in C program (SOLVED)

Martin Gürtler <[email protected]> Fri, 09 Aug 2013 11:51:26 +0200
Newsgroups gmane.comp.gnome.lib.xslt
Message-ID <[email protected]>
Am 09.08.2013 10:22, schrieb Martin Gürtler:
> 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,

The error was completely unrelated to libxslt. To enlighten myself:

For output method="text" xsltApplyStylesheet produces an xml document where the
result text is content of the root element. xsltSaveResultToFile then writes
exactly this content.

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