summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2019-06-12 11:58:44 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2019-06-12 12:01:26 +0200
commit5b0965010abf274f7a3a1291d16dde34c167e8a7 (patch)
tree61ff30111ba725b5103abda1a3014469e15e01e1 /tests
parentfbd437b4a9954fb513b8d5987b35d09b4df51ff4 (diff)
downloadlibxslt-5b0965010abf274f7a3a1291d16dde34c167e8a7.tar.gz
Backup XPath context node in xsltInitCtxtKey
Regression caused by commit 029d0e96. Closes #66.
Diffstat (limited to 'tests')
-rw-r--r--tests/docs/bug-221.xml9
-rw-r--r--tests/general/bug-221.out2
-rw-r--r--tests/general/bug-221.xsl15
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/docs/bug-221.xml b/tests/docs/bug-221.xml
new file mode 100644
index 00000000..d9d4bacf
--- /dev/null
+++ b/tests/docs/bug-221.xml
@@ -0,0 +1,9 @@
+<model>
+ <resource>
+ <action name="one"/>
+ </resource>
+ <resource>
+ <action name="one"/>
+ <action name="two"/>
+ </resource>
+</model>
diff --git a/tests/general/bug-221.out b/tests/general/bug-221.out
new file mode 100644
index 00000000..96c105e2
--- /dev/null
+++ b/tests/general/bug-221.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<r>one</r><r>two</r>
diff --git a/tests/general/bug-221.xsl b/tests/general/bug-221.xsl
new file mode 100644
index 00000000..9b4af652
--- /dev/null
+++ b/tests/general/bug-221.xsl
@@ -0,0 +1,15 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:key name="actions" match="/model/resource/action" use="@name"/>
+
+<xsl:template match="action">
+ <xsl:if test="generate-id(key('actions', @name)[1]) = generate-id(.)">
+ <r><xsl:value-of select="@name"/></r>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="model/resource/action"/>
+</xsl:template>
+
+</xsl:stylesheet>