-
Notifications
You must be signed in to change notification settings - Fork 11
/
СортировкаШаблон.xsl
52 lines (46 loc) · 1.83 KB
/
СортировкаШаблон.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
44
45
46
47
48
49
50
51
52
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="3.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<!-- <xsl:strip-space elements="*"/> -->
<!-- identity transform -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="Правило|Группа">
<xsl:sort select="Код"/>
</xsl:apply-templates>
<xsl:apply-templates select="@* | node()[not(self::Правило | self::Группа)]"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(comment() | processing-instruction() | *)][normalize-space(text()) = '']">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:for-each select="@* | namespace::*">
<xsl:copy/>
</xsl:for-each>
</xsl:element>
</xsl:template>
<!--<xsl:template match="Параметры">
<xsl:copy>
<xsl:apply-templates select="Параметр">
<xsl:sort select="@Имя" order="ascending"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>-->
<xsl:template match="Группа">
<xsl:copy>
<xsl:apply-templates select="@* | *[not(self::Правило | self::Свойство)]"/>
<xsl:apply-templates select="Правило|Свойство">
<xsl:sort select="Код"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="Свойства">
<xsl:copy>
<xsl:apply-templates select="@* | *[not(self::Группа | self::Свойство)]"/>
<xsl:apply-templates select="Группа">
<xsl:sort select="Код"/>
</xsl:apply-templates>
<xsl:apply-templates select="Свойство">
<xsl:sort select="Код"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>