X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/83b66dddb649f9bc5331970c0a1ef82396715e86..ccdc1577ef7fb32a5e30cb655337e7cd42b98987:/data/xslt/xml2dot.xsl

diff --git a/data/xslt/xml2dot.xsl b/data/xslt/xml2dot.xsl
index aa9bde0a..49f454bb 100644
--- a/data/xslt/xml2dot.xsl
+++ b/data/xslt/xml2dot.xsl
@@ -3,7 +3,7 @@
 <!--
     xml2dot.xsl - transform Bison XML Report into DOT.
 
-    Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+    Copyright (C) 2007-2012 Free Software Foundation, Inc.
 
     This file is part of Bison, the GNU Compiler Compiler.
 
@@ -35,11 +35,27 @@
 </xsl:template>
 
 <xsl:template match="bison-xml-report">
-  <xsl:apply-templates select="automaton"/>
+  <xsl:text>// Generated by GNU Bison </xsl:text>
+  <xsl:value-of select="@version"/>
+  <xsl:text>.&#10;</xsl:text>
+  <xsl:text>// Report bugs to &lt;</xsl:text>
+  <xsl:value-of select="@bug-report"/>
+  <xsl:text>&gt;.&#10;</xsl:text>
+  <xsl:text>// Home page: &lt;</xsl:text>
+  <xsl:value-of select="@url"/>
+  <xsl:text>&gt;.&#10;&#10;</xsl:text>
+  <xsl:apply-templates select="automaton">
+    <xsl:with-param name="filename" select="filename"/>
+  </xsl:apply-templates>
 </xsl:template>
 
 <xsl:template match="automaton">
-  <xsl:text>digraph Automaton {&#10;</xsl:text>
+  <xsl:param name="filename"/>
+  <xsl:text>digraph "</xsl:text>
+  <xsl:call-template name="escape">
+    <xsl:with-param name="subject" select="$filename"/>
+  </xsl:call-template>
+  <xsl:text>"&#10;{&#10;</xsl:text>
   <xsl:apply-templates select="state"/>
   <xsl:text>}&#10;</xsl:text>
 </xsl:template>
@@ -108,20 +124,20 @@
     <xsl:with-param name="dst" select="@state"/>
     <xsl:with-param name="style">
       <xsl:choose>
-	<xsl:when test="@symbol = 'error'">
-	  <xsl:text>dotted</xsl:text>
-	</xsl:when>
-	<xsl:when test="@type = 'shift'">
-	  <xsl:text>solid</xsl:text>
-	</xsl:when>
-	<xsl:otherwise>
-	  <xsl:text>dashed</xsl:text>
-	</xsl:otherwise>
+        <xsl:when test="@symbol = 'error'">
+          <xsl:text>dotted</xsl:text>
+        </xsl:when>
+        <xsl:when test="@type = 'shift'">
+          <xsl:text>solid</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>dashed</xsl:text>
+        </xsl:otherwise>
       </xsl:choose>
     </xsl:with-param>
     <xsl:with-param name="label">
       <xsl:if test="not(@symbol = 'error')">
-	<xsl:value-of select="@symbol"/>
+        <xsl:value-of select="@symbol"/>
       </xsl:if>
     </xsl:with-param>
   </xsl:call-template>