comps comps-cleanup.xsl,1.8,1.9

Nicolas Mailhot (nim) fedora-extras-commits at redhat.com
Sun Oct 8 11:14:57 UTC 2006


Author: nim

Update of /cvs/extras/comps
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22734

Modified Files:
	comps-cleanup.xsl 
Log Message:
sort attributes too


Index: comps-cleanup.xsl
===================================================================
RCS file: /cvs/extras/comps/comps-cleanup.xsl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- comps-cleanup.xsl	8 Oct 2006 10:39:31 -0000	1.8
+++ comps-cleanup.xsl	8 Oct 2006 11:14:57 -0000	1.9
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- This stylesheet will:
-     - reorder and indent a comps file,
+     - reorder, indent and normalize a comps file,
      - merge duplicate groups and categories,
-     - warn about packages referenced multiple times,
-     - keep a single package reference per group,
+     - warn about packages referenced by multiple groups,
+     - kill multiple references to the same package within a group,
 
      Typical usage is:
      $ xsltproc -o output-file comps-cleanup.xsl original-file
 
-     You can use the "novalid" xsltproc switch to kill the warning about
+     You can use the ‑‑novalid xsltproc switch to kill the warning about
      Fedora not installing the comps DTD anywhere xsltproc can find it.
      However without DTD there is no way to check the files completely.
 
@@ -27,10 +27,15 @@
   <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
 <!-- Preserve most nodes -->
   <xsl:template match="*" priority="0">
+    <xsl:apply-templates select="." mode="normalize"/>
+  </xsl:template>
+  <xsl:template match="*" mode="normalize">
 <!-- Group comments with the logically-following element -->
     <xsl:apply-templates select="preceding-sibling::node()[normalize-space()][1][self::comment()] "/>
     <xsl:copy>
-      <xsl:apply-templates select="@*"/>
+      <xsl:apply-templates select="@*">
+        <xsl:sort select="translate(name(),$lcletters,$ucletters)"/>
+      </xsl:apply-templates>
       <xsl:apply-templates select="*|text()"/>
     </xsl:copy>
   </xsl:template>
@@ -104,10 +109,6 @@
       <xsl:sort select="translate(../../id/text(),$lcletters,$ucletters)"/>
       <xsl:message>     ✓ <xsl:value-of select="@type"/> package in group <xsl:value-of select="concat(../../_name/text(),' (',../../id/text(),')')"/></xsl:message>
     </xsl:for-each>
-    <xsl:apply-templates select="preceding-sibling::node()[normalize-space()][1][self::comment()] "/>
-    <xsl:copy>
-      <xsl:apply-templates select="@*"/>
-      <xsl:apply-templates select="*|text()"/>
-    </xsl:copy>
+    <xsl:apply-templates select="." mode="normalize"/>
   </xsl:template>
 </xsl:stylesheet>




More information about the scm-commits mailing list