Re: [xslt] xsltParseStylesheetDoc Crash
- From: Daniel Veillard <veillard redhat com>
- To: Jason Keirstead <jason keirstead org>
- Cc: xslt gnome org
- Subject: Re: [xslt] xsltParseStylesheetDoc Crash
- Date: Tue, 25 Mar 2003 15:06:49 -0500
On Tue, Mar 25, 2003 at 02:57:03PM -0500, Daniel Veillard wrote:
> On Tue, Mar 25, 2003 at 03:03:43PM -0400, Jason Keirstead wrote:
> > On March 25, 2003 02:33 pm, Daniel Veillard wrote:
> > > So it's probably somewhere else and that could be version or linking
> > > problems what are the versions you used ?
> > > did you used xml2-config ? and xslt-config ? for the compile and
> > > linking flags.
> >
> > Yes of course I use the linking flags provided by xml2-config and xslt-config,
> > everything should be linked properly. I am very sure it is not a linking issue.
>
> Okay, I got annoyed enough that I wrote a test.c doing exactly what
> you say does not work, ... I don't know what your string routine does,
> my libraries are C code, I just remplaced them with const char * and
> used strlen, big surprize, it works here !!!
of course I forgot the attachement, as usual sigh ...
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
#include <stdio.h>
#include <libxml/tree.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
const char *xmlstring =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
<message direction=\"0\" from=\"UserFrom\" subject=\"\" importance=\"1\"\n\
timestamp=\"11:26:53 am\" >\n\
<from>\n\
<contact contactDisplayName=\"UserFrom\" />\n\
</from>\n\
<to>\n\
<contact contactDisplayName=\"UserTo\" />\n\
</to>\n\
<body bgcolor=\"#000000\" color=\"#000000\" font=\"Arial\" ><![CDATA[This is an\n\
incoming message]]></body>\n\
</message>\n\
";
const char *xsltstring =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n\
<xsl:template match=\"/\">\n\
<table><tr><td><xsl:value-of select=\"from/contact/@contactDisplayName\"/>:\n\
</td><td><xsl:value-of select=\"body\"/></td></tr></table>\n\
</xsl:template>\n\
</xsl:stylesheet>\n\
";
int main(void) {
xsltStylesheetPtr style_sheet = NULL;
xmlDocPtr xmlDoc, xsltDoc, resultDoc;
xmlLoadExtDtdDefaultValue = 1;
xmlSubstituteEntitiesDefault(1);
xmlDoc = xmlParseMemory(xmlstring, strlen(xmlstring));
xsltDoc = xmlParseMemory(xsltstring, strlen(xsltstring));
xmlDocDump( stdout, xmlDoc);
printf("--------\n");
xmlDocDump( stdout, xsltDoc);
printf("--------\n");
if( xsltDoc != NULL && xmlDoc != NULL ) {
style_sheet = xsltParseStylesheetDoc( xsltDoc );
if (style_sheet != NULL) {
resultDoc = xsltApplyStylesheet(style_sheet, xmlDoc, NULL);
if (resultDoc != NULL) {
xsltSaveResultToFile(stdout, resultDoc, style_sheet);
} else {
printf("xsltApplyStylesheet failed\n");
}
} else {
printf("xsltParseStylesheetDoc failed\n");
}
} else {
printf("xmlParseMemory failed\n");
}
return(0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]