[xml] xpath extension function to return valid xml code (xmlChar*)



Hi all,

I'm having an xpath function registered to be used in my .xsl files;

one of them gets buffer of bytes containing valid xml markup
I should just return within this xpath function.

static void characterDisplayableDescription(xmlXPathParserContextPtr ctxt, 
        int nargs) {

    /* ....*/

    String name = toLatin1(String((const char *)xmlXPathPopString(ctxt)));

    char buf[1024 * 64];
    if (YCharacterGetDisplayableDescription(conn, name.c_str(), buf,
            sizeof(buf)) == YACS_NO_ERROR)
        xmlXPathReturnString(ctxt, xmlStrdup((const xmlChar *)buf));
    else
        xsltGenericError(xsltGenericErrorContext,
            "yacs: character: no character by given name found.");
}


you see, I'm using xmlXPathReturnString to return the `buf` containing the 
valid xml markup.

unfortunately, when viewing my page, I can see the content as it's written in 
source, meaning, that libxslt obviousely escaped all < > etc.

How can I suppress this / how can I get my function to return what I need?

Best regards,
Christian Parpart.

Attachment: pgps9RtKgNAlX.pgp
Description: PGP signature



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