chregu Fri Nov 28 19:43:39 2003 EDT
Added files: (Branch: PHP_4_3)
/php-src/ext/domxml/tests bug26384.phpt
Modified files:
/php-src/ext/domxml php_domxml.c
Log:
enhanced bug-26384-fix. It now only does an DocCopy, if xsl:key was
found in xslt-document by default.
Index: php-src/ext/domxml/php_domxml.c
diff -u php-src/ext/domxml/php_domxml.c:1.218.2.38
php-src/ext/domxml/php_domxml.c:1.218.2.39
--- php-src/ext/domxml/php_domxml.c:1.218.2.38 Fri Nov 28 12:39:25 2003
+++ php-src/ext/domxml/php_domxml.c Fri Nov 28 19:43:37 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_domxml.c,v 1.218.2.38 2003/11/28 17:39:25 rrichards Exp $ */
+/* $Id: php_domxml.c,v 1.218.2.39 2003/11/29 00:43:37 chregu Exp $ */
/* TODO
* - Support Notation Nodes
@@ -202,6 +202,7 @@
zend_class_entry *domxsltstylesheet_class_entry;
#endif
+static int xslt_has_xsl_keys (xmlDocPtr doc);
static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC);
static int node_children(zval **children, xmlNode *nodep TSRMLS_DC);
@@ -4724,6 +4725,21 @@
/* }}} */
#endif
+static int xslt_has_xsl_keys (xmlDocPtr doc) {
+
+ xmlNode *nodep;
+ nodep = xmlDocGetRootElement(doc)->children;
+ while (nodep) {
+ if (nodep->type == XML_ELEMENT_NODE && xmlStrEqual(nodep->name, "key")
&& xmlStrEqual(nodep->ns->href, XSLT_NAMESPACE)) {
+ return 1;
+ break;
+ }
+ nodep = nodep->next;
+ }
+ return 0;
+}
+
+
/* {{{ int node_attributes(zval **attributes, int node)
Returns list of children nodes */
static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC)
@@ -5382,7 +5398,7 @@
xmlDocPtr xmldocp;
xmlDocPtr docp;
char **params = NULL;
- int ret, clone = 0;
+ int ret, clone = -1;
char *filename;
int filename_len = 0;
FILE *f;
@@ -5404,7 +5420,10 @@
}
DOMXML_GET_OBJ(xmldocp, idxml, le_domxmldocp);
-
+ if (clone == -1 && xslt_has_xsl_keys(xsltstp->doc) == 1) {
+ clone = 1;
+ }
+
if (idparams) {
params = php_domxslt_make_params(idparams, xpath_params TSRMLS_CC);
}
Index: php-src/ext/domxml/tests/bug26384.phpt
+++ php-src/ext/domxml/tests/bug26384.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php