work harder at preserving comments
This commit is contained in:
parent
132d010378
commit
4d9177e338
@ -13,7 +13,6 @@
|
||||
However without DTD there is no way to check the files completely.
|
||||
|
||||
© Nicolas Mailhot <nim at fedoraproject dot org> 2006 -->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:strip-space elements="*"/>
|
||||
<xsl:output method="xml" indent="yes" encoding="UTF-8" doctype-system="comps.dtd" doctype-public="-//Red Hat, Inc.//DTD Comps info//EN"/>
|
||||
@ -28,13 +27,20 @@
|
||||
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||
<!-- Preserve most nodes -->
|
||||
<xsl:template match="*" priority="0">
|
||||
<!-- 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="*|text()|comment()"/>
|
||||
<xsl:apply-templates select="*|text()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<!-- Preserve attributes and comments -->
|
||||
<xsl:template match="@*|comment()">
|
||||
<!-- Preserve attributes and text nodes -->
|
||||
<xsl:template match="comment()|text()">
|
||||
<xsl:apply-templates select="preceding-sibling::node()[normalize-space()][1][self::comment()] "/>
|
||||
<xsl:copy/>
|
||||
</xsl:template>
|
||||
<!-- Preserve attributes -->
|
||||
<xsl:template match="@*">
|
||||
<xsl:copy/>
|
||||
</xsl:template>
|
||||
<!-- Sort groups by id -->
|
||||
@ -50,13 +56,11 @@
|
||||
</xsl:template>
|
||||
<!-- Warn about duplicate groups being merged -->
|
||||
<xsl:template match="group[generate-id(.) != generate-id(key('unique-groups',id/text())[1])]" priority="2">
|
||||
<xsl:message>☹☹ Duplicate group <xsl:value-of select="concat(_name/text(),' (',id/text(),')')"/> will be merged.</xsl:message>
|
||||
<xsl:message> </xsl:message>
|
||||
<xsl:message> ☹☹ Duplicate group <xsl:value-of select="concat(_name/text(),' (',id/text(),')')"/> will be merged.</xsl:message>
|
||||
</xsl:template>
|
||||
<!-- Warn about duplicate categories being merged -->
|
||||
<xsl:template match="category[generate-id(.) != generate-id(key('unique-categories',id/text())[1])]" priority="2">
|
||||
<xsl:message>☹☹ Duplicate category <xsl:value-of select="concat(_name/text(),' (',id/text(),')')"/> will be merged.</xsl:message>
|
||||
<xsl:message> </xsl:message>
|
||||
<xsl:message> ☹☹ Duplicate category <xsl:value-of select="concat(_name/text(),' (',id/text(),')')"/> will be merged.</xsl:message>
|
||||
</xsl:template>
|
||||
<!-- Sort packages within a group by class then name -->
|
||||
<xsl:template match="packagelist" priority="1">
|
||||
@ -87,23 +91,21 @@
|
||||
<xsl:template match="packagereq[generate-id(.) != generate-id(key('unique-package-entries',concat(../../id/text(),'/',text()))[1])]" priority="2">
|
||||
<xsl:message>☹☹☹ Ignoring duplicate reference to <xsl:value-of select="concat(@type,' package ',text())"/> in group <xsl:value-of select="concat(../../_name/text(),' (',../../id/text(),')')"/>.</xsl:message>
|
||||
<xsl:message> Only its first reference (<xsl:value-of select="key('unique-package-entries',concat(../../id/text(),'/',text()))[1]/@type"/> package) will be kept.</xsl:message>
|
||||
<xsl:message> </xsl:message>
|
||||
</xsl:template>
|
||||
<!-- Kill duplicate group entries -->
|
||||
<xsl:template match="category/grouplist/groupid[generate-id(.) != generate-id(key('unique-group-entries',concat(../../id/text(),'/',text()))[1])]" priority="1">
|
||||
<xsl:message>☹ Ignoring duplicate reference to group <xsl:value-of select="text()"/> in category <xsl:value-of select="concat(../../_name/text(),' (',../../id/text(),')')"/>.</xsl:message>
|
||||
<xsl:message> </xsl:message>
|
||||
<xsl:message> ☹ Ignoring duplicate reference to group <xsl:value-of select="text()"/> in category <xsl:value-of select="concat(../../_name/text(),' (',../../id/text(),')')"/>.</xsl:message>
|
||||
</xsl:template>
|
||||
<!-- Warn about packages referenced several times (at least twice;)) -->
|
||||
<xsl:template match="packagereq[generate-id(.) = generate-id(key('unique-packages',text())[2])]" priority="1">
|
||||
<xsl:message>☹ Package <xsl:value-of select="text()"/> is referenced several times:</xsl:message>
|
||||
<xsl:message> ☹ Package <xsl:value-of select="text()"/> is referenced in multiple groups:</xsl:message>
|
||||
<xsl:for-each select="key('unique-packages',text())">
|
||||
<xsl:message> ✓ <xsl:value-of select="@type"/> package in group <xsl:value-of select="concat(../../_name/text(),' (',../../id/text(),')')"/></xsl:message>
|
||||
<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:message> </xsl:message>
|
||||
<xsl:apply-templates select="preceding-sibling::node()[normalize-space()][1][self::comment()] "/>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
<xsl:apply-templates select="*|text()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
Loading…
Reference in New Issue
Block a user