fixed bug #101003 on attribute-sets value computation in the presence of
authorDaniel Veillard <veillard@src.gnome.org>
Sun, 12 Jan 2003 22:58:59 +0000 (22:58 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Sun, 12 Jan 2003 22:58:59 +0000 (22:58 +0000)
* libxslt/attributes.c libxslt/xsltInternals.h libxslt/imports.c
  libxslt/xslt.c: fixed bug #101003 on attribute-sets value
  computation in the presence of imports
* tests/docs/Makefile.am tests/docs/bug-102.xml
  tests/general/Makefile.am tests/general/bug-102*: added an
  example in the regression tests for this case
Daniel

ChangeLog
libxslt/imports.c
libxslt/xslt.c
libxslt/xsltInternals.h
tests/docs/Makefile.am
tests/docs/bug-102.xml [new file with mode: 0644]
tests/general/Makefile.am
tests/general/bug-102-inc.out [new file with mode: 0644]
tests/general/bug-102-inc.xsl [new file with mode: 0644]
tests/general/bug-102.out [new file with mode: 0644]
tests/general/bug-102.xsl [new file with mode: 0644]

index fa37bf7..74db91c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sun Jan 12 23:56:18 CET 2003 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/attributes.c libxslt/xsltInternals.h libxslt/imports.c
+         libxslt/xslt.c: fixed bug #101003 on attribute-sets value
+         computation in the presence of imports
+       * tests/docs/Makefile.am tests/docs/bug-102.xml
+         tests/general/Makefile.am tests/general/bug-102*: added an
+         example in the regression tests for this case
+
 Fri Jan 10 10:34:23 CET 2003 Daniel Veillard <daniel@veillard.com>
 
        * xsltproc/xsltproc.c: final touch to #102800 fix
index 0a5cd50..8b9bdf3 100644 (file)
@@ -114,7 +114,7 @@ xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) {
        goto error;
     }
 
-    res = xsltParseStylesheetDoc(import);
+    res = xsltParseStylesheetImportedDoc(import);
     if (res != NULL) {
        res->parent = style;
        res->next = style->imports;
index 49b7bdc..d00d31c 100644 (file)
@@ -1945,22 +1945,22 @@ xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) {
        template->content = doc->children;
        xsltAddTemplate(ret, template, NULL, NULL);
     }
-    xsltResolveStylesheetAttributeSet(ret);
 
     return(ret);
 }
 
 /**
- * xsltParseStylesheetDoc:
+ * xsltParseStylesheetImportedDoc:
  * @doc:  and xmlDoc parsed XML
  *
  * parse an XSLT stylesheet building the associated structures
+ * except the processing not needed for imported documents.
  *
  * Returns a new XSLT stylesheet structure.
  */
 
 xsltStylesheetPtr
-xsltParseStylesheetDoc(xmlDocPtr doc) {
+xsltParseStylesheetImportedDoc(xmlDocPtr doc) {
     xsltStylesheetPtr ret;
 
     if (doc == NULL)
@@ -1972,11 +1972,33 @@ xsltParseStylesheetDoc(xmlDocPtr doc) {
     
     ret->doc = doc;
     xsltGatherNamespaces(ret);
-       if (xsltParseStylesheetProcess(ret, doc) == NULL) {
-               ret->doc = NULL;
-               xsltFreeStylesheet(ret);
-               ret = NULL;
-       }
+    if (xsltParseStylesheetProcess(ret, doc) == NULL) {
+       ret->doc = NULL;
+       xsltFreeStylesheet(ret);
+       ret = NULL;
+    }
+
+    return(ret);
+}
+
+/**
+ * xsltParseStylesheetDoc:
+ * @doc:  and xmlDoc parsed XML
+ *
+ * parse an XSLT stylesheet building the associated structures
+ *
+ * Returns a new XSLT stylesheet structure.
+ */
+
+xsltStylesheetPtr
+xsltParseStylesheetDoc(xmlDocPtr doc) {
+    xsltStylesheetPtr ret;
+
+    ret = xsltParseStylesheetImportedDoc(doc);
+    if (ret == NULL)
+       return(NULL);
+
+    xsltResolveStylesheetAttributeSet(ret);
 
     return(ret);
 }
index ac6141b..ecdf878 100644 (file)
@@ -542,6 +542,7 @@ xsltStylesheetPtr   xsltParseStylesheetProcess(xsltStylesheetPtr ret,
 void                   xsltParseStylesheetOutput(xsltStylesheetPtr style,
                                                  xmlNodePtr cur);
 xsltStylesheetPtr      xsltParseStylesheetDoc  (xmlDocPtr doc);
+xsltStylesheetPtr      xsltParseStylesheetImportedDoc(xmlDocPtr doc);
 xsltStylesheetPtr      xsltLoadStylesheetPI    (xmlDocPtr doc);
 void                   xsltNumberFormat        (xsltTransformContextPtr ctxt,
                                                 xsltNumberDataPtr data,
index f6f5793..97e4bc2 100644 (file)
@@ -101,6 +101,7 @@ EXTRA_DIST =        \
        bug-99.xml \
        bug-100.xml \
        bug-101.xml \
+       bug-102.xml \
        character.xml \
        array.xml \
        items.xml
diff --git a/tests/docs/bug-102.xml b/tests/docs/bug-102.xml
new file mode 100644 (file)
index 0000000..69d62f2
--- /dev/null
@@ -0,0 +1 @@
+<doc/>
index 3f84445..255c027 100644 (file)
@@ -105,6 +105,8 @@ EXTRA_DIST = \
     bug-99.out bug-99.xsl \
     bug-100.out bug-100.xsl \
     bug-101.out bug-101.xsl \
+    bug-102.out bug-102.xsl \
+    bug-102-inc.out bug-102-inc.xsl \
     character.out character.xsl \
     character2.out character2.xsl \
     itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-102-inc.out b/tests/general/bug-102-inc.out
new file mode 100644 (file)
index 0000000..4052716
--- /dev/null
@@ -0,0 +1,3 @@
+<font text-align="start" size="+1">
+    foo
+    </font>
diff --git a/tests/general/bug-102-inc.xsl b/tests/general/bug-102-inc.xsl
new file mode 100644 (file)
index 0000000..03d3368
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" 
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="html"/>
+  <xsl:attribute-set name="foo-attribs">
+    <xsl:attribute name="size">+1</xsl:attribute>
+  </xsl:attribute-set>
+
+  <xsl:attribute-set name="foo-dep-attribs"
+    use-attribute-sets="foo-attribs">
+    <xsl:attribute name="text-align">start</xsl:attribute>
+  </xsl:attribute-set>
+  <xsl:template match="/">
+    <font xsl:use-attribute-sets="foo-dep-attribs">
+    foo
+    </font>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/tests/general/bug-102.out b/tests/general/bug-102.out
new file mode 100644 (file)
index 0000000..e3dd1f4
--- /dev/null
@@ -0,0 +1,3 @@
+<font text-align="start" size="+2">
+    foo
+    </font>
diff --git a/tests/general/bug-102.xsl b/tests/general/bug-102.xsl
new file mode 100644 (file)
index 0000000..c23087d
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" 
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
+  <xsl:import href="bug-102-inc.xsl"/>
+  
+  <xsl:attribute-set name="foo-attribs">
+    <xsl:attribute name="size">+2</xsl:attribute>
+  </xsl:attribute-set>
+  
+</xsl:stylesheet>