Yuck - Windoze corruption! I'm doing all the xml /xslt stuff strictly on
Linux.
But, anyway .... some progress! I did this:-
root billrouter work # cat catalog.c
#include <libxml/parser.h>
#include <libxml/catalog.h>
#include <libxslt/xsltInternals.h>
#include <stdio.h>
int main(int nargs, char **argv) {
int ret;
xsltStylesheetPtr sheetPtr;
xmlInitParser();
xmlSubstituteEntitiesDefault(1);
xmlInitializeCatalog();
ret = xmlCatalogAdd((const xmlChar *)"rewriteSystem",
(const xmlChar *)"http://me/",
(const xmlChar *)"file://");
if (ret != 0) {
printf("xmlCatalogAdd returned %d\n",ret);
exit(-1);
}
sheetPtr = xsltParseStylesheetFile("testcat.xsl");
if (sheetPtr==NULL) {
printf("xsltParseStylesheetFile returned a NULL!\n");
exit(-1);
}
return 0;
}
plus created a stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="http://me/include.xsl"/>
</xsl:stylesheet>
then ran the program and got this, which (I hope) is something like the
sign of failure that you experience:-
root billrouter work # ./test
xmlNanoHTTPConnectHost: Failed to resolve host 'me' - Authoritive host
not found
xmlNanoHTTPConnectHost: Failed to resolve host 'me' - Authoritive host
not found
warning: failed to load external entity "http://me/include.xsl"
compilation error: file testcat.xsl element import
xsl:import : unable to load http://me/include.xsl
Then, I noticed that the directory /etc/xml didn't exist (or,
alternatively, was empty [same effect]), so I created the directory and
then put in an empty "catalog" file by running the utility "xmlcatalog":
root billrouter work # xmlcatalog --create > /etc/xml/catalog
and then re-ran my version of your program:-
root billrouter work # ./test
warning: failed to load external entity "file://include.xsl"
compilation error: file testcat.xsl element import
xsl:import : unable to load http://me/include.xsl
Wow - look at that!!! The substitution of file:// has been accomplished!
So - could it be that you are having the same problem? You don't have a
default /etc/xml/catalog file (or would it be \etc\xml\catalog???), and
that's causing it to fail? If so, do you have the xmlcatalog utility
program?
Incidentally, I consider the fact that it fails when /etc/xml/catalog is
not present to be a bug, but I'll have to confirm that with Daniel. If he
agrees, I'll fix it for the next release.
Hope that helps - now, I've got to get to bed (it's 23:15 here!).
Bye,
Bill