<!--
xml2dot.xsl - transform Bison XML Report into DOT.
- $Id$
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
-->
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:bison="http://www.gnu.org/software/bison/">
+
+<xsl:import href="bison.xsl"/>
<xsl:output method="text" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
<xsl:with-param name="number" select="@number"/>
<xsl:with-param name="label">
<xsl:value-of select="@number"/>
- <xsl:apply-templates select="itemset/rule"/>
+ <xsl:apply-templates select="itemset/item"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="actions/transitions"/>
<xsl:apply-templates select="transition"/>
</xsl:template>
+<xsl:template match="item">
+ <xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
+ <xsl:with-param name="point" select="@point"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="lookaheads"/>
+</xsl:template>
+
<xsl:template match="rule">
+ <xsl:param name="point"/>
<xsl:text> </xsl:text>
<xsl:value-of select="lhs"/>
<xsl:text> -></xsl:text>
- <xsl:apply-templates select="rhs/symbol|rhs/point|rhs/empty"/>
- <xsl:apply-templates select="lookaheads"/>
+ <xsl:if test="$point = 0">
+ <xsl:text> .</xsl:text>
+ </xsl:if>
+ <xsl:for-each select="rhs/symbol|rhs/empty">
+ <xsl:apply-templates select="."/>
+ <xsl:if test="$point = position()">
+ <xsl:text> .</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
</xsl:template>
<xsl:template match="symbol">
<xsl:value-of select="."/>
</xsl:template>
-<xsl:template match="point">
- <xsl:text> .</xsl:text>
-</xsl:template>
-
-<xsl:template match="empty">
- <xsl:text> /* empty */</xsl:text>
-</xsl:template>
+<xsl:template match="empty"/>
<xsl:template match="lookaheads">
<xsl:text>[</xsl:text>
</xsl:template>
<xsl:template name="escape">
- <xsl:param name="subject" required="yes"/>
+ <xsl:param name="subject"/> <!-- required -->
<xsl:call-template name="string-replace">
<xsl:with-param name="subject">
<xsl:call-template name="string-replace">