1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:php="http://php.net/xsl"
xsl:extension-element-prefixes="php"
exclude-result-prefixes="xsl php"
>
<!-- Copy nodes -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
<xsl:template match="action[@method='addJs' or @method='addCss']">
<block>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="@method = 'addJs' ">Magento\Theme\Block\Html\Head\Script</xsl:when>
<xsl:when test="@method = 'addCss'">Magento\Theme\Block\Html\Head\Css</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="php:function('strtolower', php:function('trim', php:function('preg_replace', '/[^a-z]+/i', '-', string(./*[1])), '-'))" />
</xsl:attribute>
<xsl:apply-templates select="@ifconfig" />
<arguments>
<argument name="file" xsi:type="string">
<xsl:value-of select="*[1]" />
</argument>
<xsl:if test="count(*[position() > 1])">
<argument name="properties" xsi:type="array">
<xsl:if test="*[2]"><item name="attributes" xsi:type="array"><xsl:value-of select="*[2]" /></item></xsl:if>
<xsl:if test="*[3]"><item name="ie_condition" xsi:type="array"><xsl:value-of select="*[3]" /></item></xsl:if>
<xsl:if test="*[4]"><item name="flag_name" xsi:type="array"><xsl:value-of select="*[4]" /></item></xsl:if>
</argument>
</xsl:if>
</arguments>
</block>
</xsl:template>
<xsl:template match="//reference[action[@method='removeItem']]">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
<xsl:for-each select="action[@method='removeItem']">
<remove name="{php:function('strtolower', php:function('trim', php:function('preg_replace', '/[^a-z]+/i', '-', string(*[2])), '-'))}" />
</xsl:for-each>
</xsl:template>
<!-- Delete remove item call -->
<xsl:template match="action[@method='removeItem']">
</xsl:template>
</xsl:stylesheet>