mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-11-08 11:02:18 +03:00
More work, cleanups, HTML output:
- Makefile.am tests/Makefile.am tests/REC1/Makefile.am tests/REC2/Makefile.am tests/REC2/html.xml: added tests target too, added the HTML output test - libxmls/xsltutils.c: added HTML output - libxslt/xslt.c: check version on literal result used as templates - libxslt/transform.c: fixed an error in VERSION number - libxslt/templates.c: make sure generated nodes have doc and parent properly set Daniel
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
||||
Sun Jan 21 12:03:16 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||
|
||||
* Makefile.am tests/Makefile.am tests/REC1/Makefile.am
|
||||
tests/REC2/Makefile.am tests/REC2/html.xml: added tests target
|
||||
too, added the HTML output test
|
||||
* libxmls/xsltutils.c: added HTML output
|
||||
* libxslt/xslt.c: check version on literal result used as templates
|
||||
* libxslt/transform.c: fixed an error in VERSION number
|
||||
* libxslt/templates.c: make sure generated nodes have doc and
|
||||
parent properly set
|
||||
|
||||
Sat Jan 20 23:35:07 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||
|
||||
* libxslt/Makefile.am libxslt/template.[ch]: added a template
|
||||
|
||||
@@ -24,7 +24,7 @@ xsltConf.sh: xsltConf.sh.in Makefile
|
||||
< $(srcdir)/xsltConf.sh.in > xsltConf.tmp \
|
||||
&& mv xsltConf.tmp xsltConf.sh
|
||||
|
||||
test:
|
||||
test tests:
|
||||
@(cd tests ; make test)
|
||||
|
||||
|
||||
|
||||
@@ -202,8 +202,11 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
|
||||
xmlChar *out;
|
||||
|
||||
if (in != NULL) {
|
||||
xmlNodePtr child;
|
||||
|
||||
out = xsltAttrTemplateValueProcess(ctxt, in);
|
||||
ret->children = xmlNewDocText(ctxt->output, out);
|
||||
child = xmlNewDocText(ctxt->output, out);
|
||||
xmlAddChild((xmlNodePtr) ret, child);
|
||||
xmlFree(out);
|
||||
xmlFree(in);
|
||||
} else
|
||||
@@ -233,6 +236,9 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
||||
|
||||
while (cur != NULL) {
|
||||
q = xsltAttrTemplateProcess(ctxt, target, cur);
|
||||
if (q != NULL) {
|
||||
q->parent = target;
|
||||
q->doc = ctxt->output;
|
||||
if (p == NULL) {
|
||||
ret = p = q;
|
||||
} else {
|
||||
@@ -240,6 +246,7 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
||||
q->prev = p;
|
||||
p = q;
|
||||
}
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
return(ret);
|
||||
|
||||
@@ -294,7 +294,7 @@ xsltAttribute(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
value = xmlNodeListGetString(inst->doc, inst->children, 1);
|
||||
if (value == NULL) {
|
||||
if (ns) {
|
||||
#if LIBXML_VERSION > 202111
|
||||
#if LIBXML_VERSION > 20211
|
||||
attr = xmlSetNsProp(ctxt->insert, ncname, ns->href,
|
||||
(const xmlChar *)"");
|
||||
#else
|
||||
@@ -316,6 +316,7 @@ xsltAttribute(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
#endif
|
||||
} else
|
||||
attr = xmlSetProp(ctxt->insert, ncname, value);
|
||||
|
||||
}
|
||||
|
||||
error:
|
||||
|
||||
@@ -866,7 +866,11 @@ xsltParseStylesheetDoc(xmlDocPtr doc) {
|
||||
"xsltParseStylesheetDoc : document is stylesheet\n");
|
||||
#endif
|
||||
|
||||
/* TODO: check the version */
|
||||
if (!xmlStrEqual(prop, (const xmlChar *)"1.0")) {
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"xsl:version: only 1.0 features are supported\n");
|
||||
TODO /* set up compatibility when not XSLT 1.0 */
|
||||
}
|
||||
xmlFree(prop);
|
||||
|
||||
/*
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
@@ -198,6 +199,7 @@ int
|
||||
xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
|
||||
xsltStylesheetPtr style) {
|
||||
const xmlChar *encoding;
|
||||
xmlNodePtr root;
|
||||
int base;
|
||||
|
||||
if ((buf == NULL) || (result == NULL) || (style == NULL))
|
||||
@@ -212,9 +214,22 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
|
||||
/* TODO: when outputing and having imported stylesheets, apply cascade */
|
||||
base = buf->written;
|
||||
encoding = style->encoding;
|
||||
if (xmlStrEqual(style->method, (const xmlChar *) "html")) {
|
||||
TODO /* HTML dump ... */
|
||||
} else if (xmlStrEqual(style->method, (const xmlChar *) "text")) {
|
||||
if (style->method == NULL)
|
||||
root = xmlDocGetRootElement(result);
|
||||
else
|
||||
root = NULL;
|
||||
if (((style->method != NULL) &&
|
||||
(xmlStrEqual(style->method, (const xmlChar *) "html"))) ||
|
||||
((root != NULL) &&
|
||||
(xmlStrEqual(root->name, (const xmlChar *) "html")))){
|
||||
#if LIBXML_VERSION > 20211
|
||||
htmlDocContentDumpOutput(buf, result, (const char *) encoding);
|
||||
#else
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"HTML output requires libxml version > 2.2.11\n");
|
||||
#endif
|
||||
} else if ((style->method != NULL) &&
|
||||
(xmlStrEqual(style->method, (const xmlChar *) "text"))) {
|
||||
xmlNodePtr cur;
|
||||
|
||||
cur = result->children;
|
||||
@@ -258,7 +273,7 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
|
||||
xmlNodePtr child = result->children;
|
||||
|
||||
while (child != NULL) {
|
||||
xmlNodeDumpOutput(buf, result, child, 0, style->indent,
|
||||
xmlNodeDumpOutput(buf, result, child, 0, (style->indent == 1),
|
||||
(const char *) encoding);
|
||||
xmlOutputBufferWriteString(buf, "\n");
|
||||
child = child->next;
|
||||
|
||||
@@ -18,6 +18,6 @@ LDADDS = $(top_builddir)/libxslt/libxslt.la $(LIBXML_LIBS)
|
||||
#testevents_DEPENDENCIES = $(DEPS)
|
||||
#testevents_LDADD = $(LDADDS)
|
||||
|
||||
test: $(top_builddir)/libxslt/xsltproc
|
||||
test tests: $(top_builddir)/libxslt/xsltproc
|
||||
@(cd REC1 ; make test)
|
||||
@(cd REC2 ; make test)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$(top_builddir)/libxslt/xsltproc:
|
||||
@(cd ../../libxslt ; make xsltproc)
|
||||
|
||||
test: $(top_builddir)/libxslt/xsltproc
|
||||
test tests: $(top_builddir)/libxslt/xsltproc
|
||||
@(rm -f .memdump ; touch .memdump)
|
||||
@($(top_builddir)/libxslt/xsltproc doc.xsl doc.xml > doc.res ; \
|
||||
diff result.xml doc.res ; \
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$(top_builddir)/libxslt/xsltproc:
|
||||
@(cd ../../libxslt ; make xsltproc)
|
||||
|
||||
test: $(top_builddir)/libxslt/xsltproc
|
||||
test tests: $(top_builddir)/libxslt/xsltproc
|
||||
@(rm -f .memdump ; touch .memdump)
|
||||
@($(top_builddir)/libxslt/xsltproc vrml.xsl data.xml > vrml.res ; \
|
||||
diff vrml.xml vrml.res ; \
|
||||
@@ -13,5 +13,9 @@ test: $(top_builddir)/libxslt/xsltproc
|
||||
diff svg.xml svg.res ; \
|
||||
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
|
||||
rm -f svg.res)
|
||||
@($(top_builddir)/libxslt/xsltproc html.xsl data.xml > html.res ; \
|
||||
diff html.xml html.res ; \
|
||||
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
|
||||
rm -f html.res)
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Sales Results By Division</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="1">
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html lang="en">
|
||||
<head><title>Sales Results By Division</title></head>
|
||||
<body><table border="1">
|
||||
<tr>
|
||||
<th>Division</th><th>Revenue</th><th>Growth</th><th>Bonus</th>
|
||||
<th>Division</th>
|
||||
<th>Revenue</th>
|
||||
<th>Growth</th>
|
||||
<th>Bonus</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><em>North</em></td><td>10</td><td>9</td><td>7</td>
|
||||
<td><em>West</em></td>
|
||||
<td>6</td>
|
||||
<td style="color:red">-1.5</td>
|
||||
<td>2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><em>West</em></td><td>6</td><td style="color:red">-1.5</td><td>2</td>
|
||||
<td><em>South</em></td>
|
||||
<td>4</td>
|
||||
<td>3</td>
|
||||
<td>4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><em>South</em></td><td>4</td><td>3</td><td>4</td>
|
||||
<td><em>North</em></td>
|
||||
<td>10</td>
|
||||
<td>9</td>
|
||||
<td>7</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</table></body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user