File: xml-device-sort.xsl

package info (click to toggle)
discover-data 2.2013.01.11%2Bnmu1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 6,072 kB
  • sloc: xml: 63,154; python: 658; perl: 519; makefile: 184; sh: 73; awk: 24
file content (32 lines) | stat: -rw-r--r-- 925 bytes parent folder | download | duplicates (6)
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
<?xml version="1.0" encoding="UTF-8" ?><!--*-coding: utf-8; -*-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!--

Sort *-device.xml using xslt.  Use it like this:

   xsltproc devsort.xsl bus-device.xml > bus-device.xml.new &&
     bus-device.xml.new bus-device.xml

-->

  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>

  <xsl:attribute-set name="bus">
    <xsl:attribute name="bus"><xsl:value-of select="@bus"/></xsl:attribute>
  </xsl:attribute-set>

  <xsl:template match="/device_list">
    <xsl:copy use-attribute-sets="bus">
     <xsl:for-each select="/device_list/device">
       <xsl:sort select="@vendor"/>
       <xsl:sort select="@model"/>
       <xsl:sort select="@subvendor"/>
       <xsl:sort select="@subdevice"/>
       <xsl:sort select="@busclass"/>
       <xsl:copy-of select="."/>
     </xsl:for-each>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>