[libxslt] Fix insertion of xsl:fallback content



commit 7434b5569fe9bc858900e66580d17e3b80cb80fc
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sun May 12 15:15:19 2019 +0200

    Fix insertion of xsl:fallback content
    
    Fixes bug #730171: https://bugzilla.gnome.org/show_bug.cgi?id=730171

 libxslt/transform.c       |  2 ++
 tests/docs/bug-220.xml    |  1 +
 tests/general/bug-220.out |  2 ++
 tests/general/bug-220.xsl | 15 +++++++++++++++
 4 files changed, 20 insertions(+)
---
diff --git a/libxslt/transform.c b/libxslt/transform.c
index cf6ce671..b8dc363c 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -2884,6 +2884,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
                 /*
                  * Search if there are fallbacks
                  */
+                ctxt->insert = insert;
                 child = cur->children;
                 while (child != NULL) {
                     if ((IS_XSLT_ELEM(child)) &&
@@ -2895,6 +2896,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
                     }
                     child = child->next;
                 }
+                ctxt->insert = oldInsert;
 
                 if (!found) {
                     xsltTransformError(ctxt, NULL, cur,
diff --git a/tests/docs/bug-220.xml b/tests/docs/bug-220.xml
new file mode 100644
index 00000000..69d62f2c
--- /dev/null
+++ b/tests/docs/bug-220.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/general/bug-220.out b/tests/general/bug-220.out
new file mode 100644
index 00000000..abb48c33
--- /dev/null
+++ b/tests/general/bug-220.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<r><fallback/></r>
diff --git a/tests/general/bug-220.xsl b/tests/general/bug-220.xsl
new file mode 100644
index 00000000..cc4e3e09
--- /dev/null
+++ b/tests/general/bug-220.xsl
@@ -0,0 +1,15 @@
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+    xmlns:ext="ext"
+    extension-element-prefixes="ext">
+<xsl:template match="/">
+    <r>
+        <ext:e>
+            <xsl:fallback><fallback/></xsl:fallback>
+            <ext:f/>
+        </ext:e>
+    </r>
+</xsl:template>
+</xsl:stylesheet>
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]