3 <title>Test for xslt-param PIs
</title>
4 <script src=
"/resources/testharness.js"></script>
5 <script src=
"/resources/testharnessreport.js"></script>
9 let iframe
= document
.createElement('iframe');
10 let src
= `<?xml version="1.0"?>
11 <?xslt-param name="param" value="true"?>
12 <?xml-stylesheet type="text/xml" href="#bug"?>
14 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" id="bug">
15 <xsl:output method="html"/>
16 <xsl:param name="param">false</xsl:param>
17 <xsl:template match="/">
18 <xsl:element name="script">parent.postMessage({test: 1, result: <xsl:value-of select="$param"/>}, "*");</xsl:element>
22 iframe
.src
= "data:text/xml," + encodeURIComponent(src
);
23 self
.addEventListener("message", t
.step_func_done(({data
: {test
, result
}}) => {
25 assert_true(result
, "The stylesheet param's value should be set by the xslt-param PI.");
28 document
.body
.appendChild(iframe
);
29 }, "Test for xslt-param PIs");
31 let iframe
= document
.createElement('iframe');
32 let src
= `<?xml version="1.0"?>
33 <?xslt-param-namespace prefix="foo" namespace="foonamespace"?>
34 <?xslt-param name="param" select="//foo:default"?>
35 <?xml-stylesheet type="text/xml" href="#bug"?>
37 <default xmlns="foonamespace">true</default>
38 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" id="bug">
39 <xsl:output method="html"/>
40 <xsl:param name="param">false</xsl:param>
41 <xsl:template match="/">
42 <xsl:element name="script">parent.postMessage({test: 2, result: <xsl:value-of select="$param"/>}, "*");</xsl:element>
46 iframe
.src
= "data:text/xml," + encodeURIComponent(src
);
47 self
.addEventListener("message", t
.step_func_done(({data
: {test
, result
}}) => {
49 assert_true(result
, "xslt-param-namespace should have set the right namespace");
52 document
.body
.appendChild(iframe
);
53 }, "Test for xslt-param PIs");