-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_elements.xsl
43 lines (40 loc) · 1.17 KB
/
remove_elements.xsl
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<!--
roland: remove unnedeed groups from WURFL
send comments, questions to roland guelle <[email protected]>
create a groups file like:
elements
groups
group ... /group
...
/groups
capabilities
capability ... /capability
...
/capabilities
/elements
-->
<xsl:param name="file">remove_elements.xml</xsl:param>
<xsl:param name="elements" select="document($file)"/>
<xsl:template match="group">
<xsl:if test="not(@id = $elements/elements/groups/group)">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="capability">
<xsl:if test="not(@name = $elements/elements/capabilities/capability)">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>