sort attributes too
This commit is contained in:
parent
35f1dff9f7
commit
833542b3b7
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- This stylesheet will:
|
<!-- This stylesheet will:
|
||||||
- reorder and indent a comps file,
|
- reorder, indent and normalize a comps file,
|
||||||
- merge duplicate groups and categories,
|
- merge duplicate groups and categories,
|
||||||
- warn about packages referenced multiple times,
|
- warn about packages referenced by multiple groups,
|
||||||
- keep a single package reference per group,
|
- kill multiple references to the same package within a group,
|
||||||
|
|
||||||
Typical usage is:
|
Typical usage is:
|
||||||
$ xsltproc -o output-file comps-cleanup.xsl original-file
|
$ 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.
|
Fedora not installing the comps DTD anywhere xsltproc can find it.
|
||||||
However without DTD there is no way to check the files completely.
|
However without DTD there is no way to check the files completely.
|
||||||
|
|
||||||
|
@ -27,10 +27,15 @@
|
||||||
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||||
<!-- Preserve most nodes -->
|
<!-- Preserve most nodes -->
|
||||||
<xsl:template match="*" priority="0">
|
<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 -->
|
<!-- Group comments with the logically-following element -->
|
||||||
<xsl:apply-templates select="preceding-sibling::node()[normalize-space()][1][self::comment()] "/>
|
<xsl:apply-templates select="preceding-sibling::node()[normalize-space()][1][self::comment()] "/>
|
||||||
<xsl:copy>
|
<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:apply-templates select="*|text()"/>
|
||||||
</xsl:copy>
|
</xsl:copy>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -104,10 +109,6 @@
|
||||||
<xsl:sort select="translate(../../id/text(),$lcletters,$ucletters)"/>
|
<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:message> ✓ <xsl:value-of select="@type"/> package in group <xsl:value-of select="concat(../../_name/text(),' (',../../id/text(),')')"/></xsl:message>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:apply-templates select="preceding-sibling::node()[normalize-space()][1][self::comment()] "/>
|
<xsl:apply-templates select="." mode="normalize"/>
|
||||||
<xsl:copy>
|
|
||||||
<xsl:apply-templates select="@*"/>
|
|
||||||
<xsl:apply-templates select="*|text()"/>
|
|
||||||
</xsl:copy>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
Loading…
Reference in New Issue