Skip to content

Commit

Permalink
samples; lists
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@495 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Feb 25, 2009
1 parent 4038079 commit 2234f95
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 20 deletions.
37 changes: 24 additions & 13 deletions shared/xsl/ldf2tex.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,13 @@
<xsl:text>\begin{description}</xsl:text>
<xsl:for-each select="$list/term">
<xsl:text>\item[</xsl:text>
<xsl:value-of select="name"/>
<xsl:call-template name="capitaliseString">
<xsl:with-param name="string" select="name"/>
</xsl:call-template>
<xsl:text>] </xsl:text>
<xsl:choose>
<xsl:when test="count(definition/p) = 1 and count(definition/list) = 0">
<xsl:value-of select="definition/p"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="process-text">
<xsl:with-param name="text" select="definition"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:text>\end{description}</xsl:text>
</xsl:template>
Expand Down Expand Up @@ -201,7 +196,7 @@
</xsl:when>
<!-- end of CamelCase2Whitespace -->
<xsl:otherwise>
<xsl:call-template name="capitalise">
<xsl:call-template name="capitaliseLocalName">
<xsl:with-param name="section" select="$target"/>
</xsl:call-template>
</xsl:otherwise>
Expand All @@ -218,7 +213,7 @@
<xsl:value-of select="$target/title"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="capitalise">
<xsl:call-template name="capitaliseLocalName">
<xsl:with-param name="section" select="$target"/>
</xsl:call-template>
</xsl:otherwise>
Expand All @@ -233,7 +228,7 @@
<xsl:value-of select="$target/title"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="capitalise">
<xsl:call-template name="capitaliseLocalName">
<xsl:with-param name="section" select="$target"/>
</xsl:call-template>
</xsl:otherwise>
Expand Down Expand Up @@ -318,16 +313,32 @@
</xsl:call-template>
</xsl:template>

<xsl:template name="capitalise">
<xsl:template name="capitaliseLocalName">
<xsl:param name="section"/>
<xsl:value-of select="concat(translate(substring(local-name($section),1,1), 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring(local-name($section),2))"/>
<xsl:call-template name="capitaliseString">
<xsl:with-param name="string" select="local-name($section)"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="capitaliseString">
<xsl:param name="string"/>
<xsl:value-of select="concat(translate(substring($string,1,1), 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring($string,2))"/>
</xsl:template>

<xsl:template name="uppercase">
<xsl:param name="string"/>
<xsl:value-of select="translate($string, 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
</xsl:template>

<xsl:template match="sample">
<xsl:text>
\begin{verbatim}</xsl:text>
<xsl:value-of select="."/>
<xsl:text>\end{verbatim}

</xsl:text>
</xsl:template>

<!--xsl:value-of select="."/-->
<xsl:template match="text">
<p xmlns="http://www.w3.org/1999/xhtml">
Expand Down
28 changes: 21 additions & 7 deletions shared/xsl/xbgf2xbnf.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,28 @@
</xsl:template>

<xsl:template match="xbgf:rename">
<xsl:value-of select="local-name()" />
<xsl:text>(</xsl:text>
<xsl:value-of select="local-name(*)" />
<xsl:text>
</xsl:text>
<xsl:choose>
<xsl:when test="local-name(*) = 'label'">
<xsl:text>renameL(</xsl:text>
</xsl:when>
<xsl:when test="local-name(*) = 'nonterminal'">
<xsl:text>renameN(</xsl:text>
</xsl:when>
<xsl:when test="local-name(*) = 'selector'">
<xsl:text>renameS(</xsl:text>
</xsl:when>
<xsl:when test="local-name(*) = 'terminal'">
<xsl:text>renameT(</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name()" />
<xsl:text>-</xsl:text>
<xsl:value-of select="local-name(*)" />
<xsl:text>(</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="./*/*[1]"/>
<xsl:text>,
</xsl:text>
<xsl:text>, </xsl:text>
<xsl:apply-templates select="./*/*[2]"/>
<xsl:text>);
</xsl:text>
Expand Down

0 comments on commit 2234f95

Please sign in to comment.