Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00031 #include <stdio.h>
00032
00033 #ifdef HAVE_LIBXML2
00034 #include <libxml/tree.h>
00035 #include <libxml/xmlstring.h>
00036 #endif
00037
00038 #ifdef HAVE_LIBXSLT
00039 #include <libxslt/xsltInternals.h>
00040 #include <libxslt/transform.h>
00041 #include <libxslt/xsltutils.h>
00042 #endif
00043
00044 #include <eurephia_values.h>
00045
00046
00059 int xslt_print_xmldoc(FILE *dst, eurephiaVALUES *cfg, xmlDoc *xmldoc,
00060 const char *xsltfname, const char **xsltparams)
00061 {
00062 #ifdef HAVE_LIBXSLT
00063 xmlDoc *result = NULL;
00064 xsltStylesheet *xslt = NULL;
00065 xmlChar xsltfile[2048];
00066
00067
00068 xmlStrPrintf(xsltfile,2046, (xmlChar *)"%s/%s%c", eGet_value(cfg, "eurephiadm_xslt_path"), xsltfname, 0);
00069
00070
00071 xslt = xsltParseStylesheetFile(xsltfile);
00072 if( xslt == NULL ) {
00073 return 0;
00074 }
00075
00076
00077 result = xsltApplyStylesheet(xslt, xmldoc, xsltparams);
00078 if( result == NULL ) {
00079 return 0;
00080 }
00081
00082
00083 xsltSaveResultToFile(dst, result, xslt);
00084
00085
00086 xmlFreeDoc(result);
00087 xsltFreeStylesheet(xslt);
00088 return 1;
00089 #else
00090 return 0;
00091 #endif
00092 }