@epa-wg/custom-element 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,215 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6
+ <title>importmap custom-element Declarative Custom Element implementation demo</title>
7
+ <link rel="icon" href="./wc-square.svg"/>
8
+ <script type="importmap">
9
+ {
10
+ "imports": {
11
+ "lib-root/": "./lib-dir/",
12
+ "embed-lib": "./lib-dir/embed-lib.html"
13
+ }
14
+ }
15
+ </script>
16
+ <script type="module" src="../location-element.js"></script>
17
+ <script type="module" src="../module-url.js"></script>
18
+ <script type="module" src="../custom-element.js"></script>
19
+
20
+ <style>
21
+ @import "./demo.css";
22
+
23
+ dce-root {
24
+ box-shadow: 0 0 0.5rem lime;
25
+ padding: 1rem;
26
+ display: inline-block;
27
+ }
28
+ main {
29
+ display: flex;
30
+ flex-wrap: wrap;
31
+ &>section{
32
+ flex:1 20rem;
33
+ }
34
+ }
35
+ </style>
36
+
37
+ </head>
38
+ <body>
39
+
40
+ <nav>
41
+ <h3><a href="../index.html"><code>custom-element</code> demo</a>, <code>importmap</code></h3>
42
+ </nav>
43
+ <main>
44
+ <section>
45
+ <h3>How to get the module URL for <code>custom-element</code>?</h3>
46
+ Answer: by defining following attributes in <code>module-url</code>:
47
+ <ol>
48
+ <li><code>src</code> with path to module resource, If omitted, it would match the
49
+ <code>window.location.href</code></li>
50
+ <li><code>slice</code> to read the URL</li>
51
+ </ol>
52
+ URL properties would be a part of slice data, the value would be a full URL.
53
+ </section><section>
54
+ <h3>Where to use <code>module-url</code>?</h3>
55
+ Answer: to inject the library resources URL into generated HTML.
56
+ <p><a
57
+ href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#importing_modules_using_import_maps"
58
+ >Import maps </a> are used for defining the dependencies location on the web page level.
59
+ This way dependencies could reside on different CDN path or even domains while in the code would be
60
+ referenced
61
+ by symbolic package name.
62
+ See the CDN example bellow.</p>
63
+ <br/>
64
+ <p>The resolving of import maps is done by
65
+ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve">import.meta.resolve(path)</a>
66
+ </p>
67
+ </section><section>
68
+ <h3>Where NOT to use <code>module-url</code>?</h3>
69
+ Answer:
70
+ <ol>
71
+ <li> in <code>scr</code> attribute of &lt;custom-element &gt;<br/>
72
+ - It uses the same module resolving mechanism
73
+ </li>
74
+ <li> for getting/setting the page URL,<br/>
75
+ - see <a href="./set-url.html">How to set page URL in <code>custom-element</code>?</a>
76
+
77
+ </li>
78
+ </ol>
79
+
80
+ <h3>See also</h3>
81
+ <p><a href="./external-template.html">How to use external templates?</a></p>
82
+ </section>
83
+ <section>
84
+ <html-demo-element legend="this page import maps"
85
+ >
86
+ <template>
87
+ {
88
+ "imports": {
89
+ "lib-root": "./lib-dir/",
90
+ "embed-lib": "./lib-dir/embed-lib.html"
91
+ }
92
+ }
93
+ </template>
94
+ </html-demo-element>
95
+ </section>
96
+ </main>
97
+
98
+
99
+ <html-demo-element legend="1. relative to page path"
100
+ description="Should render Vulcan Salute 🖖 with link to embed-1.html, link should open the page"
101
+ >
102
+ <template>
103
+ <custom-element>
104
+ <a href="./embed-1.html">
105
+ <custom-element src="./embed-1.html"></custom-element>
106
+ </a>
107
+ </custom-element>
108
+ </template>
109
+ </html-demo-element>
110
+
111
+ <html-demo-element legend="2. module by symbolic name"
112
+ description="should render '👋 from embed-lib-component' as link to 'demo-lib/embed-lib.html', link should open the page "
113
+ >
114
+ <p><code>embed-lib</code> resolved to <code>./lib-dir/embed-lib.html</code> by page <i>importmap</i></p>
115
+ <template>
116
+ <custom-element>
117
+ <template>
118
+ <module-url slice="lib-url" src="embed-lib"></module-url>
119
+ <if test="//lib-url/@error">
120
+ <p>error: <b>{//lib-url/@error}</b></p>
121
+ </if>
122
+ check the link:
123
+ <a href="{//lib-url}">
124
+ <custom-element src="embed-lib#embed-lib-component">
125
+ failed to load
126
+ </custom-element>
127
+ </a>
128
+ </template>
129
+ </custom-element>
130
+
131
+ </template>
132
+ </html-demo-element>
133
+
134
+ <html-demo-element legend="3. module by symbolic name with missing importmap entry"
135
+ description="should render error message and `failed to load` broken link "
136
+ >
137
+ <p>As <code>fakedemo-lib</code> is not in importmaps, the symbolic name is not resolved and renders the error</p>
138
+
139
+ <template>
140
+ <custom-element>
141
+ <template>
142
+ <module-url slice="lib-url" src="fakedemo-lib/embed-lib.html"></module-url>
143
+ <if test="//lib-url/@error">
144
+ <p>error: <b>{//lib-url/@error}</b></p>
145
+ </if>
146
+ the link is broken:
147
+ <a href="{//lib-url}">
148
+ <custom-element src="fakedemo-lib/embed-lib.html#embed-lib-component">
149
+ failed to load
150
+ </custom-element>
151
+ </a>
152
+ </template>
153
+ </custom-element>
154
+ </template>
155
+ </html-demo-element>
156
+
157
+
158
+ <html-demo-element legend="4. module path by symbolic name"
159
+ description="should render two smiley images and links should open matching page"
160
+ >
161
+ <p><code>lib-root</code> resolved to <code>lib-dir</code> by page <i>importmap</i></p>
162
+ <template>
163
+ <custom-element>
164
+ <template>
165
+ <module-url slice="lib-url" src="lib-root/embed-lib.html#embed-relative-hash"></module-url>
166
+ <module-url slice="img-url" src="lib-root/Smiley.svg"></module-url>
167
+ <if test="//lib-url/@error">
168
+ <p>error: <b>{//lib-url/@error}</b></p>
169
+ </if>
170
+ check the link:
171
+ <a href="{//lib-url}"> lib-root/embed-lib.html#embed-relative-hash <img src="{//img-url}" alt=""/></a>
172
+ <custom-element src="lib-root/embed-lib.html#embed-relative-hash">
173
+ failed to load
174
+ </custom-element>
175
+
176
+ </template>
177
+ </custom-element>
178
+
179
+ </template>
180
+ </html-demo-element>
181
+
182
+ <html-demo-element legend="5. module path by symbolic name to internal link within lib"
183
+ description="should render '👍 from embed-relative-file' and Vulcan Salute 🖖. Links should open matching page "
184
+ >
185
+ <template>
186
+ <custom-element>
187
+ <template>
188
+ <module-url slice="lib-url" src="lib-root/embed-lib.html#embed-relative-file"></module-url>
189
+ <if test="//lib-url/@error">
190
+ <p>error: <b>{//lib-url/@error}</b></p>
191
+ </if>
192
+ check the link:
193
+ <a href="{//lib-url}"> lib-root/embed-lib.html#embed-relative-file </a>
194
+ <custom-element src="lib-root/embed-lib.html#embed-relative-file">
195
+ failed to load
196
+ </custom-element>
197
+
198
+ </template>
199
+ </custom-element>
200
+
201
+ </template>
202
+ </html-demo-element>
203
+
204
+
205
+ <html-demo-element src="./lib-dir/embed-lib.html"
206
+ legend="./lib-dir/embed-lib.html"
207
+ description="resides within ./lib-dir and serves a sample of module with multiple templates"
208
+ >
209
+
210
+ </html-demo-element>
211
+
212
+ <script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
213
+
214
+ </body>
215
+ </html>
@@ -0,0 +1,105 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5
+ <title>DOM merge - Declarative Custom Element implementation demo</title>
6
+ <link rel="icon" href="./wc-square.svg"/>
7
+
8
+ <script type="module" src="../http-request.js"></script>
9
+ <script type="module" src="../custom-element.js"></script>
10
+ <style>
11
+ @import "./demo.css";
12
+ dt{ font-weight: bold}
13
+ dd{ padding: 0;}
14
+ h1,h3{ margin: 0;}
15
+ nav{ gap:0; }
16
+ </style>
17
+ </head>
18
+ <body>
19
+
20
+ <nav>
21
+ <a href="../index.html"><h3><code>custom-element</code> demo</h3></a>
22
+ <h1><code>npm-version</code> Declarative Custom Element</h1>
23
+
24
+ <dl>
25
+ <dt>Attributes</dt>
26
+ <dd><code>package-name</code> NPM package name</dd>
27
+ <dd><code>current-version</code> version to be initially selected </dd>
28
+ <dd><code>value</code> user selection </dd>
29
+
30
+ <dt>Events</dt>
31
+ <dd><code>change</code> triggered when <code>value</code> attribute changed</dd>
32
+
33
+ <dt>Slots</dt>
34
+ <dd><code>label</code> defaults to <code>{$package-name} version:</code> </dd>
35
+ </dl>
36
+
37
+ </nav>
38
+
39
+
40
+ <html-demo-element legend="1. NPM package version picker"
41
+ description="defaults, last version should be preselected">
42
+ <template>
43
+ <custom-element tag="npm-version" src="./npm-versions.html#npm-version"></custom-element>
44
+ <npm-version package-name="@epa-wg/custom-element-dist"></npm-version>
45
+ </template>
46
+ </html-demo-element>
47
+
48
+ <html-demo-element legend="2. preselected NPM package version picker"
49
+ description="version 22 should be selected">
50
+ <template>
51
+ <custom-element tag="custom-element-version" src="./npm-versions.html#npm-version"></custom-element>
52
+ <custom-element-version current-version="0.0.22" package-name="@epa-wg/custom-element"></custom-element-version>
53
+ </template>
54
+ </html-demo-element>
55
+
56
+
57
+ <html-demo-element legend="3. value attribute changed and propagated to slice"
58
+ description="upon selection change the version should be shown as 'selected-version' slice value">
59
+ <template>
60
+ <custom-element tag="npm-version" src="./npm-versions.html#npm-version"></custom-element>
61
+
62
+ <custom-element >
63
+ <template>
64
+ <npm-version slice="selected-version" package-name="@epa-wg/custom-element"></npm-version>
65
+ <p><code>selected-version</code> slice: {//selected-version/@value}</p>
66
+ </template>
67
+ </custom-element>
68
+
69
+ </template>
70
+ </html-demo-element>
71
+
72
+
73
+ <html-demo-element legend="4. label slot override"
74
+ description="upon selection change the version should be shown as 'selected-version' slice value">
75
+ <template>
76
+ <custom-element tag="npm-version-1" src="./npm-versions.html#npm-version"></custom-element>
77
+
78
+ <custom-element >
79
+ <template>
80
+ <npm-version-1 slice="selected" package-name="@epa-wg/custom-element">
81
+ <i slot="label">select:</i>
82
+ </npm-version-1>
83
+ <p><code>selected-version</code> slice: {//selected}</p>
84
+ </template>
85
+ </custom-element>
86
+
87
+ </template>
88
+ </html-demo-element>
89
+
90
+
91
+ <html-demo-element legend="5. control version in URL"
92
+ description="">
93
+ 1. <button onclick="window.location.hash = `#@epa-wg/custom-element-dist@0.0.26/storybook-static/index.html`">set in page URL</button>
94
+ (can be skipped when run from unpkg.com)<br/>
95
+ 2. switch the package version in select and observe the URL change.
96
+ <template>
97
+ <custom-element src="./npm-versions.html#npm-version-to-url" package-name="custom-element-dist" current-version="0.0.26"></custom-element>
98
+ </template>
99
+ </html-demo-element>
100
+
101
+
102
+ <script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js" hidden></script>
103
+
104
+ </body>
105
+ </html>
@@ -0,0 +1,65 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5
+ <title>npm-version template</title>
6
+ <link rel="icon" href="./wc-square.svg"/>
7
+ </head>
8
+ <body>
9
+
10
+ <h1><code>npm-version</code> template</h1>
11
+ <a href="./npm-versions-demo.html">docs</a>
12
+ <template id="npm-version">
13
+ <attribute name="package-name"></attribute>
14
+ <attribute name="current-version"></attribute>
15
+ <attribute name="value" select="//selected-version"></attribute>
16
+
17
+ <http-request
18
+ url="https://registry.npmjs.org/@epa-wg/custom-element-dist"
19
+ method="GET"
20
+ header-accept="application/json"
21
+ slice="versions-ajax"></http-request>
22
+
23
+ <label><slot name="label">{$package-name} version:</slot>
24
+ <xhtml:select slice="selected-version" autocomplete="off" name="version">
25
+ <for-each select="//versions/*">
26
+ <option value="{./@version}">
27
+ <variable name="item-version">{./@version}</variable>
28
+ { $item-version } - { substring( //time/*[@dce-object-name = $item-version ], 1,10)}
29
+ </option>
30
+ </for-each>
31
+ <for-each select="//versions/*">
32
+ <if test="./@version = $current-version">
33
+ <option selected value="{./@version}">
34
+ <variable name="item-version">{./@version}</variable>
35
+ { $item-version } - { substring( //time/*[@dce-object-name = $item-version ], 1,10)}
36
+ </option>
37
+ </if>
38
+ </for-each>
39
+ </xhtml:select>
40
+ </label>
41
+ </template>
42
+
43
+ <template id="npm-version-to-url">
44
+ <variable name="url" select="//window-location/value/@href"></variable>
45
+ <variable name="current-version" >0{
46
+ substring-before(substring-after(substring($url, string-length(substring-before($url, '/')) - string-length(substring-before(substring-before($url, '/'), '@0')) + 2), '@0'), '/')
47
+ }</variable>
48
+ <location-element slice="window-location" live>
49
+ <if test=" not(//selected-version = $current-version ) and not(//selected-version = '') ">
50
+ <attribute name="src">{ concat( substring-before($url, $current-version),
51
+ //selected-version,
52
+ substring-after($url, $current-version) ) }</attribute>
53
+ <attribute name="method">location.href</attribute>
54
+ </if>
55
+ </location-element>
56
+ <http-request
57
+ url="https://registry.npmjs.org/@epa-wg/custom-element-dist"
58
+ method="GET"
59
+ header-accept="application/json"
60
+ slice="versions-ajax" ></http-request>
61
+
62
+ <custom-element src="#npm-version" slice="selected-version"></custom-element>
63
+ </template>
64
+ </body>
65
+ </html>
package/demo/s.xml CHANGED
@@ -1,11 +1,28 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <datadom>
3
- <slice>
4
- <signin-form>
5
- <form-data>
6
- <username>QWE</username>
7
- <password>ASD</password>
8
- </form-data>
9
- </signin-form>
10
- </slice>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <datadom>
3
+ <payload xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
4
+ <span xmlns="http://www.w3.org/1999/xhtml" slot=""></span>
5
+ <npm-version xmlns="http://www.w3.org/1999/xhtml" slice="selected-version" package-name="@epa-wg/custom-element"
6
+ slot=""></npm-version>
7
+ <span xmlns="http://www.w3.org/1999/xhtml" slot=""></span>
8
+ <p xmlns="http://www.w3.org/1999/xhtml" slot="">
9
+ <code>selected-version</code>
10
+ slice: {//selected-version}
11
+ </p>
12
+ <span xmlns="http://www.w3.org/1999/xhtml" slot=""></span>
13
+ </payload>
14
+ <attributes>
15
+ <tag>dce-bbc8e8b4-575f-40d3-9880-2f1d56d85d80</tag>
16
+ </attributes>
17
+ <dataset/>
18
+ <slice>
19
+ <selected-version xmlns="" slice="selected-version" package-name="@epa-wg/custom-element" data-dce-id="2"
20
+ current-version="" value="0.0.21">
21
+ <event isTrusted="false" sliceProcessed="1" type="change" eventPhase="2" bubbles="true" cancelable="false"
22
+ defaultPrevented="false" composed="false" timeStamp="2225577.4000000954" returnValue="true"
23
+ cancelBubble="false" NONE="0" CAPTURING_PHASE="1" AT_TARGET="2" BUBBLING_PHASE="3">
24
+ <detail package-name="@epa-wg/custom-element"/>
25
+ </event>
26
+ </selected-version>
27
+ </slice>
11
28
  </datadom>
package/demo/s.xslt CHANGED
@@ -1,60 +1,97 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml"
3
- xmlns:dce="urn:schemas-epa-wg:dce" xmlns:exsl="http://exslt.org/common" version="1.0"
4
- exclude-result-prefixes="exsl">
5
- <xsl:template match="ignore">
6
- <xsl:choose>
7
- <xsl:when test="//attr">
8
- <xsl:value-of select="//attr"/>
9
- </xsl:when>
10
- <xsl:otherwise>
11
- <xsl:value-of select="def"/>
12
- </xsl:otherwise>
13
- </xsl:choose>
14
- <xsl:value-of select="."/>
15
- </xsl:template>
16
- <xsl:template mode="payload" match="attributes">
17
- <dce-root xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" data-dce-id="1">
18
- <u xmlns="" data-dce-id="2">
19
- <dce-text data-dce-id="3">
20
- <xsl:call-template name="slot">
21
- <xsl:with-param name="slotname" select="''"/>
22
- <xsl:with-param name="defaultvalue">
23
- <dce-text xmlns="" data-dce-id="4">is green</dce-text>
24
- </xsl:with-param>
25
- </xsl:call-template>
26
- </dce-text>
27
- </u>
28
- </dce-root>
29
- </xsl:template>
30
- <xsl:template match="/">
31
- <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
32
- </xsl:template>
33
-
34
- <xsl:template match="@*|node()" mode="copy-html">
35
- <xsl:copy><xsl:apply-templates select="@*|node()" mode="copy-html"/></xsl:copy>
36
- </xsl:template>
37
- <xsl:template match="node()[starts-with(name(),'xhtml:')]" mode="copy-html">
38
- <xsl:element name="{local-name()}"><xsl:apply-templates select="@*|node()" mode="copy-html"/></xsl:element>
39
- </xsl:template>
40
-
41
-
42
- <xsl:template name="slot">
43
- <xsl:param name="slotname"/>
44
- <xsl:param name="defaultvalue"/>
45
- <xsl:choose>
46
- <xsl:when test="//payload/*[@slot=$slotname]">
47
- <xsl:apply-templates mode="copy-html" select="//payload/*[@slot=$slotname]"/>
48
- </xsl:when>
49
- <xsl:otherwise>
50
- <xsl:apply-templates mode="copy-html" select="$defaultvalue"/>
51
- </xsl:otherwise>
52
- </xsl:choose>
53
- </xsl:template>
54
- <xsl:variable name="js-injected-body">
55
- <xsl:call-template name="slot">
56
- <xsl:with-param name="slotname" select="''"/>
57
- <xsl:with-param name="defaultvalue"/>
58
- </xsl:call-template>
59
- </xsl:variable>
1
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml"
2
+ xmlns:dce="urn:schemas-epa-wg:dce" xmlns:exsl="http://exslt.org/common" version="1.0"
3
+ exclude-result-prefixes="exsl">
4
+ <xsl:template match="ignore">
5
+ <xsl:choose>
6
+ <xsl:when test="//attr">
7
+ <xsl:value-of select="//attr"/>
8
+ </xsl:when>
9
+ <xsl:otherwise>
10
+ <xsl:value-of select="def"/>
11
+ </xsl:otherwise>
12
+ </xsl:choose>
13
+ <xsl:value-of select="."/>
14
+ </xsl:template>
15
+ <xsl:template mode="payload" match="attributes">
16
+ <dce-root xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" data-dce-id="1">
17
+ <xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="methods">
18
+ <a xmlns="" href="https://developer.mozilla.org/en-US/docs/Web/API/Location/href" data-dce-id="2">
19
+ location.href
20
+ </a>
21
+ <a xmlns="" href="https://developer.mozilla.org/en-US/docs/Web/API/Location/hash" data-dce-id="3">
22
+ location.hash
23
+ </a>
24
+ <a xmlns="" href="https://developer.mozilla.org/en-US/docs/Web/API/Location/assign" data-dce-id="4">
25
+ location.assign
26
+ </a>
27
+ </xsl:variable>
28
+ <fieldset xmlns="" data-dce-id="5">
29
+ <legend data-dce-id="6">
30
+ <b data-dce-id="7">set-by</b>
31
+ </legend>
32
+ <xsl:for-each xmlns:xsl="http://www.w3.org/1999/XSL/Transform" select="$methods">
33
+ <p data-dce-id="8">
34
+ <label data-dce-id="9">
35
+ <input type="radio" name="method" value="{.}" data-dce-id="10"/>
36
+ <dce-text data-dce-id="11">
37
+ <xsl:value-of select="."/>
38
+ </dce-text>
39
+ </label>
40
+ <a class="infolink" href="https://developer.mozilla.org/en-US/docs/Web/API/Location/assign"
41
+ data-dce-id="12">mdn
42
+ </a>
43
+ </p>
44
+ </xsl:for-each>
45
+ <label data-dce-id="13">
46
+ <input type="radio" name="method" value="location.href" data-dce-id="14"/>
47
+ <dce-text data-dce-id="15">location.href</dce-text>
48
+ </label>
49
+ <label data-dce-id="16">
50
+ <input type="radio" name="method" value="location" data-dce-id="17"/>
51
+ <dce-text data-dce-id="18">location</dce-text>
52
+ </label>
53
+ <label data-dce-id="19">
54
+ <input type="radio" name="method" value="location.replace" data-dce-id="20"/>
55
+ <dce-text data-dce-id="21">location.replace</dce-text>
56
+ </label>
57
+ <label data-dce-id="22">
58
+ <input type="radio" name="method" value="location.assign" data-dce-id="23"/>
59
+ <dce-text data-dce-id="24">location.assign</dce-text>
60
+ </label>
61
+ <label data-dce-id="25">
62
+ <input type="radio" name="method" value="location.hash" data-dce-id="26"/>
63
+ <dce-text data-dce-id="27">location.hash</dce-text>
64
+ </label>
65
+ <label data-dce-id="28">
66
+ <input type="radio" name="method" value="history.pushState" data-dce-id="29"/>
67
+ <dce-text data-dce-id="30">history.pushState</dce-text>
68
+ </label>
69
+ <label data-dce-id="31">
70
+ <input type="radio" name="method" value="history.replaceState" data-dce-id="32"/>
71
+ <dce-text data-dce-id="33">history.replaceState</dce-text>
72
+ </label>
73
+ </fieldset>
74
+ </dce-root>
75
+ </xsl:template>
76
+ <xsl:template match="/">
77
+ <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
78
+ </xsl:template>
79
+ <xsl:template name="slot">
80
+ <xsl:param name="slotname"/>
81
+ <xsl:param name="defaultvalue"/>
82
+ <xsl:choose>
83
+ <xsl:when test="//payload/*[@slot=$slotname]">
84
+ <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
85
+ </xsl:when>
86
+ <xsl:otherwise>
87
+ <xsl:copy-of select="$defaultvalue"/>
88
+ </xsl:otherwise>
89
+ </xsl:choose>
90
+ </xsl:template>
91
+ <xsl:variable name="js-injected-body">
92
+ <xsl:call-template name="slot">
93
+ <xsl:with-param name="slotname" select="''"/>
94
+ <xsl:with-param name="defaultvalue"/>
95
+ </xsl:call-template>
96
+ </xsl:variable>
60
97
  </xsl:stylesheet>