+Wed Apr 25 16:58:11 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * transform.c: fixed text and cdata handling in xsl:copy
+ * xslt.c : avoid crashing on invalid xslt input
+ * test/general/bug-*.* test/docs/bug-*.xml : added a number of
+ bugs submitted to the regression tests
+
Wed Apr 25 12:42:48 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/xsltproc.c : Renaud Chaillat provided a fix for #53535
oldInsert = ctxt->insert;
if (ctxt->insert != NULL) {
switch (node->type) {
+ case XML_TEXT_NODE:
+ case XML_CDATA_SECTION_NODE:
+ /*
+ * This text comes from the stylesheet
+ * For stylesheets, the set of whitespace-preserving
+ * element names consists of just xsl:text.
+ */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+ if (node->type == XML_CDATA_SECTION_NODE)
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsl:copy: CDATA text %s\n", node->content);
+ else
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsl:copy: text %s\n", node->content);
+#endif
+ copy = xmlNewText(node->content);
+ if (copy != NULL) {
+ if (node->name == xmlStringTextNoenc)
+ copy->name = xmlStringTextNoenc;
+ xmlAddChild(ctxt->insert, copy);
+ } else {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:copy: text copy failed\n");
+ }
+ break;
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
break;
xmlFreeNode(delete);
delete = NULL;
}
- if (IS_XSLT_ELEM(cur)) {
+ if ((cur->type == XML_ELEMENT_NODE) && (IS_XSLT_ELEM(cur))) {
if (IS_XSLT_NAME(cur, "text")) {
goto skip_children;
}
}
} else if (cur->type != XML_ELEMENT_NODE) {
delete = cur;
+ goto skip_children;
}
/*
* Skip to next node
*/
if (cur->children != NULL) {
- if (cur->children->type != XML_ENTITY_DECL) {
+ if ((cur->children->type != XML_ENTITY_DECL) &&
+ (cur->children->type != XML_ENTITY_REF_NODE) &&
+ (cur->children->type != XML_ENTITY_NODE)) {
cur = cur->children;
continue;
}
if (cur == NULL) {
xsltGenericError(xsltGenericErrorContext,
"xsltParseStylesheetProcess : empty stylesheet\n");
+ ret->doc = NULL;
xsltFreeStylesheet(ret);
return(NULL);
}
if (prop == NULL) {
xsltGenericError(xsltGenericErrorContext,
"xsltParseStylesheetProcess : document is not a stylesheet\n");
+ ret->doc = NULL;
xsltFreeStylesheet(ret);
return(NULL);
}
*/
template = xsltNewTemplate();
if (template == NULL) {
+ ret->doc = NULL;
xsltFreeStylesheet(ret);
return(NULL);
}
ret->doc = doc;
xsltGatherNamespaces(ret);
- xsltParseStylesheetProcess(ret, doc);
+ ret = xsltParseStylesheetProcess(ret, doc);
return(ret);
}
--- /dev/null
+<?xml version= "1.0"?>
+<doc/>
+
--- /dev/null
+<?xml version= "1.0"?>
+
+<doc/>
+
--- /dev/null
+<?xml version='1.0' encoding="ISO-8859-1"?>
+
+<test:schema xmlns:test="http://test.com"
+ xmlns:xlink="http://xlink.com">
+<test:root >
+ <test:child>
+ </test:child>
+</test:root>
+</test:schema>
--- /dev/null
+<some>text</some>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ROOT>
+ <GROUP name="G1">
+ <MEMBER name="M1">
+ <CONTENT>MEMBER 1 of GROUP 1</CONTENT>
+ </MEMBER>
+ <MEMBER name="M2">
+ <CONTENT>MEMBER 2 of GROUP 1</CONTENT>
+ </MEMBER>
+ <MEMBER name="M3">
+ <CONTENT>MEMBER 3 of GROUP 1</CONTENT>
+ </MEMBER>
+ </GROUP>
+
+ <GROUP name="G2">
+ <MEMBER name="M1">
+ <CONTENT>MEMBER 1 of GROUP 2</CONTENT>
+ </MEMBER>
+ <MEMBER name="M2">
+ <CONTENT>MEMBER 2 of GROUP 2</CONTENT>
+ </MEMBER>
+ <MEMBER name="M3">
+ <CONTENT>MEMBER 3 of GROUP 2</CONTENT>
+ </MEMBER>
+ </GROUP>
+
+ <GROUP name="G3">
+ <MEMBER name="M1">
+ <CONTENT>MEMBER 1 of GROUP 3</CONTENT>
+ </MEMBER>
+ <MEMBER name="M2">
+ <CONTENT>MEMBER 2 of GROUP 3</CONTENT>
+ </MEMBER>
+ <MEMBER name="M3">
+ <CONTENT>MEMBER 3 of GROUP 3</CONTENT>
+ </MEMBER>
+ </GROUP>
+</ROOT>
--- /dev/null
+<?xml version="1.0"?>
+
+<aaa xmlns:bbb="test:7" bbb:ddd="ccc" eee="fff"/>
--- /dev/null
+<?xml version= "1.0"?>
+<document xmlns="http://my/namespace">
+ <item>Success</item>
+</document>
+
--- /dev/null
+<?xml version="1.0"?>
+Success
--- /dev/null
+<?xml version= "1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="/">
+<xsl:text><![CDATA[Success]]></xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "http://www.w3.org/TR/REC-html40/loose.dtd" "-//W3C//DTD HTML 4.0 Transitional//EN">
+<?php Success>
--- /dev/null
+<?xml version= "1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="html"/>
+<!--xsl:import href="test2.xsl"/-->
+
+<xsl:template match="/">
+<xsl:processing-instruction name="php">Success</xsl:processing-instruction>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<namespace>http://test.com</namespace>
--- /dev/null
+<?xml version='1.0' encoding="ISO-8859-1"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="xml"
+ version="1.0"
+ encoding="ISO-8859-1"
+ indent="yes" />
+
+<xsl:template match="/">
+ <namespace>
+ <xsl:value-of select="//namespace::*"/>
+ </namespace>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+<some>text</some>
--- /dev/null
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="*|@*|text()">
+ <xsl:copy>
+ <xsl:apply-templates select="*|@*|text()"/>
+ </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+<MEMBER name="M2">
+ <CONTENT>MEMBER 2 of GROUP 2</CONTENT>
+ </MEMBER>
+<MEMBER name="M2">
+ <CONTENT>MEMBER 2 of GROUP 3</CONTENT>
+ </MEMBER>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/">
+ <xsl:apply-templates select="ROOT"/>
+</xsl:template>
+<xsl:template match="ROOT">
+ <xsl:for-each select="GROUP[position() != 1]/MEMBER[2]">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+cccfff
--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:bbb="test:7">
+
+ <xsl:template match="aaa">
+ <xsl:value-of select="@bbb:ddd"/>
+ <xsl:value-of select="@eee"/>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+
+ Big
--- /dev/null
+<?xml version= "1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:import href="inner.xsl"/>
+
+ <!-- Root Node -->
+ <xsl:template match="/">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+<?php Success?>
@(cd ../../libxslt ; make xsltproc)
EXTRA_DIST = REC-xml-20001006.xml xmlspec-v21.dtd W3C-REC.css \
- logo-REC xmlspec.xsl REC-xml-2e.xsl diffspec.xsl
+ logo-REC xmlspec.xsl REC-xml-2e.xsl diffspec.xsl \
+ REC-xml-20001006.html REC-xml-20001006-review.html
all: test