-<xsl:template match="conflict">
- <a>
- <xsl:attribute name="href">
- <xsl:value-of select="concat('#state_', @state)"/>
- </xsl:attribute>
- <xsl:value-of select="concat('State ', @state)"/>
- </a>
- <xsl:text> conflicts: </xsl:text>
- <xsl:value-of select="@num"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="@type"/>
- <xsl:text> </xsl:text>
+<xsl:template match="state" mode="conflicts">
+ <xsl:variable name="conflict-counts">
+ <xsl:apply-templates select="." mode="bison:count-conflicts" />
+ </xsl:variable>
+ <xsl:variable
+ name="sr-count" select="substring-before($conflict-counts, ',')"
+ />
+ <xsl:variable
+ name="rr-count" select="substring-after($conflict-counts, ',')"
+ />
+ <xsl:if test="$sr-count > 0 or $rr-count > 0">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#state_', @number)"/>
+ </xsl:attribute>
+ <xsl:value-of select="concat('State ', @number)"/>
+ </a>
+ <xsl:text> conflicts:</xsl:text>
+ <xsl:if test="$sr-count > 0">
+ <xsl:value-of select="concat(' ', $sr-count, ' shift/reduce')"/>
+ <xsl:if test="$rr-count > 0">
+ <xsl:value-of select="(',')"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$rr-count > 0">
+ <xsl:value-of select="concat(' ', $rr-count, ' reduce/reduce')"/>
+ </xsl:if>
+ <xsl:value-of select="' '"/>
+ </xsl:if>