Skip to content

Commit

Permalink
fixed broken scripts; finished half-done ones
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@797 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed May 9, 2010
1 parent 775dffe commit d007265
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
11 changes: 9 additions & 2 deletions shared/xsl/bgf2dms.xslt
Expand Up @@ -27,7 +27,7 @@
<xsl:choose>
<xsl:when test="./bgf:expression/choice">
<xsl:for-each select="./bgf:expression/choice/bgf:expression">
<xsl:value-of select="./nonterminal"/>
<xsl:value-of select="../../../nonterminal"/>
<xsl:text> = </xsl:text>
<xsl:call-template name="no-parenthesis">
<xsl:with-param name="expr" select="."/>
Expand Down Expand Up @@ -108,7 +108,14 @@
</xsl:template>

<xsl:template match="nonterminal">
<xsl:value-of select="."/>
<xsl:choose>
<xsl:when test="text() = 'identifier'">
<xsl:text>IDENTIFIER</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="selectable">
Expand Down
9 changes: 8 additions & 1 deletion shared/xsl/bgf2sdf.xslt
Expand Up @@ -52,9 +52,14 @@ exports
<xsl:template match="bgf:production">
<xsl:choose>
<xsl:when test="./bgf:expression/choice">
<xsl:for-each select="./bgf:expression/choice/bgf:expression">
<xsl:text>
</xsl:text>
<xsl:call-template name="no-parenthesis">
<xsl:with-param name="expr" select="./bgf:expression/choice/bgf:expression[1]"/>
</xsl:call-template>
<xsl:for-each select="./bgf:expression/choice/bgf:expression[position()>1]">
<xsl:text>
| </xsl:text>
<xsl:call-template name="no-parenthesis">
<xsl:with-param name="expr" select="."/>
</xsl:call-template>
Expand All @@ -77,6 +82,8 @@ exports
<xsl:value-of select="./label"/>
<xsl:text>)}</xsl:text>
</xsl:if>
<xsl:text>
</xsl:text>
</xsl:template>

<xsl:template match="bgf:expression">
Expand Down
50 changes: 46 additions & 4 deletions shared/xsl/bgf2xhtml.xslt
Expand Up @@ -11,7 +11,43 @@
/>

<xsl:template match="/bgf:grammar">
<xsl:apply-templates select="./bgf:*"/>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Browsable Grammar</title>
<style type="text/css">
h1, table { text-align: center; }
.label, .sel { color: green; }
.marked { background-color: #FFE5B4;}
.nt { color: blue; font-weight: bold; }
.t { color: red; font-style:italic; }
.meta { color: green; font-style:italic; font-family: Roman, "Times New Roman", serif; }
h6 { text-align: right; }
.date { font-size: small; }

.note
{
text-align: right;
font-weight: bold;
margin: 0px;
}
.frame, pre
{
border: 1px solid black;
border-spacing: 2px;
border-collapse: collapse;
background-color: #ECECEC;
}

</style>
</head>
<body>
<xsl:for-each select="./bgf:*">
<pre>
<xsl:apply-templates select="."/>
</pre>
</xsl:for-each>
</body>
</html>
</xsl:template>

<xsl:template match="bgf:production">
Expand Down Expand Up @@ -62,17 +98,23 @@

<xsl:template match="plus">
<xsl:apply-templates select="./*"/>
<xsl:text>+</xsl:text>
<span xmlns="http://www.w3.org/1999/xhtml" class="meta">
<xsl:text>+</xsl:text>
</span>
</xsl:template>

<xsl:template match="star">
<xsl:apply-templates select="./*"/>
<xsl:text>*</xsl:text>
<span xmlns="http://www.w3.org/1999/xhtml" class="meta">
<xsl:text>*</xsl:text>
</span>
</xsl:template>

<xsl:template match="optional">
<xsl:apply-templates select="./*"/>
<xsl:text>?</xsl:text>
<span xmlns="http://www.w3.org/1999/xhtml" class="meta">
<xsl:text>?</xsl:text>
</span>
</xsl:template>

<xsl:template match="terminal">
Expand Down

0 comments on commit d007265

Please sign in to comment.