Mercurial > dive4elements > river
comparison artifacts/contrib/list-unused-macros.xsl @ 5987:e5e2b0630855
Datacage: Added stylesheet to detect macros which are defined and not called and vice versa.
Usage: xsltproc contrib/list-unused-macros.xsl doc/conf/meta-data.xml
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 12 May 2013 16:15:37 +0200 |
parents | |
children | 9543b768d740 |
comparison
equal
deleted
inserted
replaced
5986:600280716e25 | 5987:e5e2b0630855 |
---|---|
1 <?xml version="1.0" encoding="UTF-8"?> | |
2 <xsl:stylesheet | |
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
4 xmlns:dc="http://www.intevation.org/2011/Datacage" | |
5 version="1.0"> | |
6 | |
7 <xsl:output method="text" encoding="UTF-8"/> | |
8 | |
9 <xsl:template match="/"> | |
10 <xsl:text>Marcos defined but not called:
</xsl:text> | |
11 <xsl:for-each select="//dc:macro/@name"> | |
12 <xsl:variable name="mname" select="."/> | |
13 <xsl:if test="count(//dc:call-macro[@name=$mname]) = 0"> | |
14 <xsl:text> </xsl:text> | |
15 <xsl:value-of select="$mname"/> | |
16 <xsl:text>
</xsl:text> | |
17 </xsl:if> | |
18 </xsl:for-each> | |
19 | |
20 <xsl:text>Marcos called but not defined:
</xsl:text> | |
21 <xsl:for-each select="//dc:call-macro/@name"> | |
22 <xsl:variable name="mname" select="."/> | |
23 <xsl:if test="count(//dc:macro[@name=$mname]) = 0"> | |
24 <xsl:text> </xsl:text> | |
25 <xsl:value-of select="$mname"/> | |
26 <xsl:text>
</xsl:text> | |
27 </xsl:if> | |
28 </xsl:for-each> | |
29 </xsl:template> | |
30 </xsl:stylesheet> | |
31 |