+Sat Jan 22 11:24:43 CET 2005 Daniel Veillard <daniel@veillard.com>
+
+ * libxslt/xslt.c: internalize all text node content from
+ stylesheet documents with the stylesheet dictionnary
+
Fri Jan 21 12:04:18 HKT 2005 William Brack <wbrack@mmm.com.hk>
* tests/plugins/Makefile.am: Applied patch 11 (with small
static void
xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) {
xmlNodePtr delete;
+ int internalize = 0;
+
+ if ((style != NULL) && (cur != NULL) && (cur->doc != NULL) &&
+ (style->dict != NULL) && (cur->doc->dict == style->dict))
+ internalize = 1;
/*
* This content comes from the stylesheet
if (cur->type == XML_ELEMENT_NODE) {
int exclPrefixes;
+ /*
+ * Internalize attributes values.
+ */
+ if ((internalize) && (cur->properties != NULL)) {
+ xmlAttrPtr prop = cur->properties;
+ xmlNodePtr txt;
+
+ while (prop != NULL) {
+ txt = prop->children;
+ if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
+ (txt->content != NULL) &&
+ (!xmlDictOwns(style->dict, txt->content))) {
+ xmlChar *old = (xmlChar *) txt->content;
+
+ /*
+ * internalize the text string, goal is to speed
+ * up operations and minimize used space by compiled
+ * stylesheets.
+ */
+ txt->content = (xmlChar *)
+ xmlDictLookup(style->dict, old, -1);
+ xmlFree(old);
+ }
+ prop = prop->next;
+ }
+ }
+
exclPrefixes = xsltParseStylesheetExcludePrefix(style, cur);
if (IS_XSLT_ELEM(cur)) {
xsltStylePreCompute(style, cur);
if (xmlNodeGetSpacePreserve(cur) != 1) {
delete = cur;
}
+ } else if ((cur->content != NULL) && (internalize) &&
+ (!xmlDictOwns(style->dict, cur->content))) {
+ xmlChar *old = (xmlChar *) cur->content;
+
+ /*
+ * internalize the text string, goal is to speed
+ * up operations and minimize used space by compiled
+ * stylesheets.
+ */
+ cur->content = (xmlChar *) xmlDictLookup(style->dict, old, -1);
+ xmlFree(old);
}
} else if ((cur->type != XML_ELEMENT_NODE) &&
(cur->type != XML_CDATA_SECTION_NODE)) {