1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2026-01-07 21:58:22 +03:00

- doc/xslt.html: fixed a link error

- libxslt/transform.c libxslt/xsltutils.c: fixed DOCTYPE generation
- libxslt/xsltproc.c: cleaned up the --repeat loop
- tests/documents/result.xhtml tests/xmlspec/REC-xml-20001006*.html:
  fixed the DOCTYPE in tests output
- tests/docs/bug-25-.xml tests/doc/Makefile.am
  tests/general/bug-25-.* tests/general/Makefile.am : added a new
  test case and fixed the EXTRA_DIST
Daniel
This commit is contained in:
Daniel Veillard
2001-05-08 14:24:04 +00:00
parent c0985f8498
commit 2e8ebaef0d
13 changed files with 79 additions and 57 deletions

View File

@@ -1,3 +1,14 @@
Tue May 8 16:18:19 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* doc/xslt.html: fixed a link error
* libxslt/transform.c libxslt/xsltutils.c: fixed DOCTYPE generation
* libxslt/xsltproc.c: cleaned up the --repeat loop
* tests/documents/result.xhtml tests/xmlspec/REC-xml-20001006*.html:
fixed the DOCTYPE in tests output
* tests/docs/bug-25-.xml tests/doc/Makefile.am
tests/general/bug-25-.* tests/general/Makefile.am : added a new
test case and fixed the EXTRA_DIST
Mon May 7 22:27:03 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/extra.c: add more debug to xsltDebug

View File

@@ -285,7 +285,7 @@ orchis:~ -&gt;</pre>
<p>Okay this section is clearly incomplete. But integrating libxslt into your
application should be realitively easy. First check the few steps described
below, then for more detailed informations, look at the<a
href="libxslt-lib.html"> generated pages</a> for the API and the source of
href="html/libxslt-lib.html"> generated pages</a> for the API and the source of
libxslt/xsltproc.c .</p>
<p>Basically doing an XSLT transformation can be done in a few steps:</p>

View File

@@ -2496,6 +2496,8 @@ xsltApplyStylesheet(xsltStylesheetPtr style, xmlDocPtr doc,
xmlDocPtr res = NULL;
xsltTransformContextPtr ctxt = NULL;
xmlNodePtr root;
const xmlChar *method;
const xmlChar *encoding;
if ((style == NULL) || (doc == NULL))
return(NULL);
@@ -2503,19 +2505,25 @@ xsltApplyStylesheet(xsltStylesheetPtr style, xmlDocPtr doc,
xsltRegisterExtras(ctxt);
if (ctxt == NULL)
return(NULL);
if ((style->method != NULL) &&
(!xmlStrEqual(style->method, (const xmlChar *) "xml"))) {
if (xmlStrEqual(style->method, (const xmlChar *) "html")) {
XSLT_GET_IMPORT_PTR(method, style, method)
if ((method != NULL) &&
(!xmlStrEqual(method, (const xmlChar *) "xml"))) {
const xmlChar *doctypePublic;
const xmlChar *doctypeSystem;
XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
if (xmlStrEqual(method, (const xmlChar *) "html")) {
ctxt->type = XSLT_OUTPUT_HTML;
res = htmlNewDoc(style->doctypeSystem, style->doctypePublic);
res = htmlNewDoc(doctypeSystem, doctypePublic);
if (res == NULL)
goto error;
} else if (xmlStrEqual(style->method, (const xmlChar *) "xhtml")) {
} else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) {
xsltGenericError(xsltGenericErrorContext,
"xsltApplyStylesheet: insupported method xhtml, using html\n",
style->method);
ctxt->type = XSLT_OUTPUT_HTML;
res = htmlNewDoc(style->doctypeSystem, style->doctypePublic);
res = htmlNewDoc(doctypeSystem, doctypePublic);
if (res == NULL)
goto error;
} else if (xmlStrEqual(style->method, (const xmlChar *) "text")) {
@@ -2554,13 +2562,17 @@ xsltApplyStylesheet(xsltStylesheetPtr style, xmlDocPtr doc,
xsltCleanupTemplates(style);
if ((ctxt->type == XSLT_OUTPUT_XML) &&
((style->doctypePublic != NULL) ||
(style->doctypeSystem != NULL))) {
if (ctxt->type == XSLT_OUTPUT_XML) {
const xmlChar *doctypePublic;
const xmlChar *doctypeSystem;
XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
root = xmlDocGetRootElement(res);
if (root != NULL)
if ((root != NULL) &&
((doctypePublic != NULL) || (doctypeSystem != NULL)))
res->intSubset = xmlCreateIntSubset(res, root->name,
style->doctypePublic, style->doctypeSystem);
doctypePublic, doctypeSystem);
}
xmlXPathFreeNodeSet(ctxt->nodeList);
xsltFreeTransformContext(ctxt);

View File

@@ -220,11 +220,21 @@ main(int argc, char **argv) {
gettimeofday(&begin, NULL);
if (repeat) {
int j;
for (j = 0;j < repeat; j++) {
for (j = 1;j < repeat; j++) {
res = xsltApplyStylesheet(cur, doc, params);
xmlFreeDoc(res);
xmlFreeDoc(doc);
doc = xmlParseFile(argv[i]);
#ifdef LIBXML_HTML_ENABLED
if (html)
doc = htmlParseFile(argv[i], NULL);
else
#endif
#ifdef LIBXML_HTML_ENABLED
if (docbook)
doc = docbParseFile(argv[i], NULL);
else
#endif
doc = xmlParseFile(argv[i]);
}
}
res = xsltApplyStylesheet(cur, doc, params);

View File

@@ -503,7 +503,6 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
return(-1);
}
/* TODO: when outputing and having imported stylesheets, apply cascade */
base = buf->written;
XSLT_GET_IMPORT_PTR(method, style, method)
@@ -545,15 +544,11 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
int standalone;
int indent;
const xmlChar *version;
const xmlChar *doctypePublic;
const xmlChar *doctypeSystem;
XSLT_GET_IMPORT_INT(omitXmlDecl, style, omitXmlDeclaration);
XSLT_GET_IMPORT_INT(standalone, style, standalone);
XSLT_GET_IMPORT_INT(indent, style, indent);
XSLT_GET_IMPORT_PTR(version, style, version)
XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
if (omitXmlDecl != 1) {
xmlOutputBufferWriteString(buf, "<?xml version=");
@@ -585,39 +580,6 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
}
xmlOutputBufferWriteString(buf, "?>\n");
}
if ((doctypePublic != NULL) || (doctypeSystem != NULL)) {
xmlNodePtr cur = result->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE)
break;
cur = cur->next;
}
if ((cur != NULL) && (cur->name != NULL)) {
xmlOutputBufferWriteString(buf, "<!DOCTYPE ");
xmlOutputBufferWriteString(buf, (const char *) cur->name);
if (doctypePublic != NULL) {
if (doctypeSystem != NULL) {
xmlOutputBufferWriteString(buf, " PUBLIC ");
xmlBufferWriteQuotedString(buf->buffer,
doctypePublic);
xmlOutputBufferWriteString(buf, " ");
xmlBufferWriteQuotedString(buf->buffer,
doctypeSystem);
} else {
xmlOutputBufferWriteString(buf, " PUBLIC \"-\" ");
xmlBufferWriteQuotedString(buf->buffer,
doctypeSystem);
}
} else {
xmlOutputBufferWriteString(buf, " SYSTEM ");
xmlBufferWriteQuotedString(buf->buffer,
doctypeSystem);
}
xmlOutputBufferWriteString(buf, ">\n");
}
}
if (result->children != NULL) {
xmlNodePtr child = result->children;

View File

@@ -24,6 +24,12 @@ EXTRA_DIST = \
bug-17-.xml \
bug-18-.xml \
bug-19-.xml \
bug-20-.xml \
bug-21-.xml \
bug-22-.xml \
bug-23-.xml \
bug-24-.xml \
bug-25-.xml \
character.xml \
items.xml

1
tests/docs/bug-25-.xml Normal file
View File

@@ -0,0 +1 @@
<doc/>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>Home</title><link rel="stylesheet" href="bredfort.css" type="text/css" title="bredfort"/></head><body><table class="menu"><tr>
<td class="menu"><a href="index.html">Home</a></td>
<td class="menu"><a href="worklog.html">Worklog</a></td>

View File

@@ -23,6 +23,12 @@ EXTRA_DIST = \
bug-17-.out bug-17-.xsl \
bug-18-.out bug-18-.xsl \
bug-19-.out bug-19-.xsl \
bug-20-.out bug-20-.xsl \
bug-21-.out bug-21-.xsl \
bug-22-.out bug-22-.xsl \
bug-23-.out bug-23-.xsl \
bug-24-.out bug-24-.xsl \
bug-25-.out bug-25-.xsl \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE doc PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<doc/>

10
tests/general/bug-25-.xsl Normal file
View File

@@ -0,0 +1,10 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8"
doctype-public="-//WAPFORUM//DTD WML 1.1//EN"
doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"/>
<xsl:template match="/">
<doc/>
</xsl:template>
</xsl:stylesheet>

View File

@@ -1,3 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="EN">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
@@ -176,7 +177,7 @@ Normalization</a>
<br>C <a href="#sec-xml-and-sgml">XML and SGML</a> (Non-Normative)<br>D <a href="#sec-entexpand">Expansion of Entity and Character References</a> (Non-Normative)<br>E <a href="#determinism">Deterministic Content Models</a> (Non-Normative)<br>F <a href="#sec-guessing">Autodetection
of Character Encodings</a> (Non-Normative)<br><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F.1 <a href="#sec-guessing-no-ext-info">Detection Without External Encoding Information</a>
<br><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F.2 <a href="#sec-guessing-with-ext-info">Priorities in the Presence of External Encoding Information</a>
<br>G <a href="#sec-xml-wg">W3C XML Working Group</a> (Non-Normative)<br>H <a href="#sec-core-wg">W3C XML Core Group</a> (Non-Normative)<br>I <a href="#id2657962">Production Notes</a> (Non-Normative)<br>
<br>G <a href="#sec-xml-wg">W3C XML Working Group</a> (Non-Normative)<br>H <a href="#sec-core-wg">W3C XML Core Group</a> (Non-Normative)<br>I <a href="#id2664223">Production Notes</a> (Non-Normative)<br>
</p>
</div>
<hr>
@@ -4379,7 +4380,7 @@ Contact</i>) </li>
<div class="diff-add"><div class="div1">
<h2>
<a name="id2657962"></a>I Production Notes (Non-Normative)</h2>
<a name="id2664223"></a>I Production Notes (Non-Normative)</h2>
<p>This Second Edition was encoded in the <a href="http://www.w3.org/XML/1998/06/xmlspec-v21.dtd">XMLspec
DTD</a> (which has <a href="http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm">documentation</a>
available). The HTML versions were produced with a combination of the <a href="http://www.w3.org/XML/1998/06/xmlspec.xsl">xmlspec.xsl</a>, <a href="http://www.w3.org/XML/1998/06/diffspec.xsl">diffspec.xsl</a>,

View File

@@ -1,3 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="EN">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
@@ -155,7 +156,7 @@ Normalization</a>
<br>C <a href="#sec-xml-and-sgml">XML and SGML</a> (Non-Normative)<br>D <a href="#sec-entexpand">Expansion of Entity and Character References</a> (Non-Normative)<br>E <a href="#determinism">Deterministic Content Models</a> (Non-Normative)<br>F <a href="#sec-guessing">Autodetection
of Character Encodings</a> (Non-Normative)<br><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F.1 <a href="#sec-guessing-no-ext-info">Detection Without External Encoding Information</a>
<br><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F.2 <a href="#sec-guessing-with-ext-info">Priorities in the Presence of External Encoding Information</a>
<br>G <a href="#sec-xml-wg">W3C XML Working Group</a> (Non-Normative)<br>H <a href="#sec-core-wg">W3C XML Core Group</a> (Non-Normative)<br>I <a href="#id2657962">Production Notes</a> (Non-Normative)<br>
<br>G <a href="#sec-xml-wg">W3C XML Working Group</a> (Non-Normative)<br>H <a href="#sec-core-wg">W3C XML Core Group</a> (Non-Normative)<br>I <a href="#id2664223">Production Notes</a> (Non-Normative)<br>
</p>
</div>
<hr>
@@ -4028,7 +4029,7 @@ Contact</i>) </li>
<div class="div1">
<h2>
<a name="id2657962"></a>I Production Notes (Non-Normative)</h2>
<a name="id2664223"></a>I Production Notes (Non-Normative)</h2>
<p>This Second Edition was encoded in the <a href="http://www.w3.org/XML/1998/06/xmlspec-v21.dtd">XMLspec
DTD</a> (which has <a href="http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm">documentation</a>
available). The HTML versions were produced with a combination of the <a href="http://www.w3.org/XML/1998/06/xmlspec.xsl">xmlspec.xsl</a>, <a href="http://www.w3.org/XML/1998/06/diffspec.xsl">diffspec.xsl</a>,