1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Add new xslt files, which I forgot earlier

svn path=/trunk/icecast/; revision=3775
This commit is contained in:
Michael Smith 2002-08-09 08:16:51 +00:00
parent fce9ecb952
commit 0ecb66895a
2 changed files with 91 additions and 0 deletions

65
src/xslt.c Normal file
View File

@ -0,0 +1,65 @@
#include <string.h>
#include <libxml/xmlmemory.h>
#include <libxml/debugXML.h>
#include <libxml/HTMLtree.h>
#include <libxml/xmlIO.h>
#include <libxml/DOCBparser.h>
#include <libxml/xinclude.h>
#include <libxml/catalog.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <thread/thread.h>
#include <avl/avl.h>
#include <httpp/httpp.h>
#include <net/sock.h>
#include "connection.h"
#include "global.h"
#include "refbuf.h"
#include "client.h"
#include "stats.h"
void transformXSLT(xmlDocPtr doc, char *xslfilename, client_t *client)
{
xmlOutputBufferPtr outputBuffer;
xmlDocPtr res;
xsltStylesheetPtr cur;
const char *params[16 + 1];
size_t count,nBytes;
params[0] = NULL;
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
cur = xsltParseStylesheetFile(xslfilename);
if (cur == NULL) {
sock_write_string(client->con->sock, (char *)"Could not parse XSLT file");
return;
}
res = xsltApplyStylesheet(cur, doc, params);
outputBuffer = xmlAllocOutputBuffer(NULL);
count = xsltSaveResultTo(outputBuffer, res, cur);
/* Add null byte to end. */
nBytes = xmlOutputBufferWrite(outputBuffer, 1, "");
sock_write_string(client->con->sock, (char *)outputBuffer->buffer->content);
xmlFree(outputBuffer);
xsltFreeStylesheet(cur);
xmlFreeDoc(res);
xsltCleanupGlobals(); /* Neccesary? */
}

26
src/xslt.h Normal file
View File

@ -0,0 +1,26 @@
#include <libxml/xmlmemory.h>
#include <libxml/debugXML.h>
#include <libxml/HTMLtree.h>
#include <libxml/xmlIO.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <thread/thread.h>
#include <avl/avl.h>
#include <httpp/httpp.h>
#include <net/sock.h>
#include "connection.h"
#include "global.h"
#include "refbuf.h"
#include "client.h"
#include "stats.h"
void transformXSLT(xmlDocPtr doc, char *xslfilename, client_t *client);