[Mono-list] More help needed with XSLT
Miguel de Icaza
miguel@ximian.com
19 Feb 2003 23:29:55 -0500
--=-wcCHv8SFEInMicT1y3cY
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hey guys!
I need some more help with my XSLT. I asked Peter first this time,
as he always reply quickly, but he is busy this week ;-)
We need a few more tags supported, the details are here:
www.go-mono.com/documentation.html
The tags am looking to support are:
<code lang="C#">.. </code>
Those happen inside the "<example>" bits.
<list type="bullet"> </list>
That is basically a <ul> list in HTML
And the table ones:
<list type="table"> </lits>
<listheader>
<term>YOUR FIRST COLUMN</term>
<description>YOUR DESCRIPTION</description>
</listheader>
<item>
<term>First</term>
<description>First descritpion</description>
</item>
<item>
<term>Second</term>
<description>Second descirption</description>
</item>
Here is again my XSLT file
--=-wcCHv8SFEInMicT1y3cY
Content-Disposition: attachment; filename=mono-ecma.xsl
Content-Type: text/plain; name=mono-ecma.xsl; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<?xml version=3D"1.0"?>
<xsl:stylesheet version=3D"1.0" xmlns:xsl=3D"http://www.w3.org/1999/XSL/Tra=
nsform">
=09
<xsl:template name=3D"string-replace" >
<xsl:param name=3D"string"/>
<xsl:param name=3D"from"/>
<xsl:choose>
<xsl:when test=3D"contains($string,'(')">
<xsl:call-template name=3D"string-replace">
<xsl:with-param name=3D"string" select=3D"substring-before($string,'(')=
"/>
<xsl:with-param name=3D"from" select=3D"$from"/>
</xsl:call-template>
</xsl:when>
<xsl:when test=3D"contains($string,$from)">
<xsl:call-template name=3D"string-replace">
<xsl:with-param name=3D"string" select=3D"substring-after($string,$from=
)"/>
<xsl:with-param name=3D"from" select=3D"$from"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=3D"$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>=09
<xsl:template name=3D"string-addsignature">
<xsl:param name=3D"string"/>
<xsl:choose>
<xsl:when test=3D"contains($string,'(')">
(<xsl:value-of select=3D"substring-after($string,'(')"/>
</xsl:when>
</xsl:choose>
</xsl:template>=09
=09
=09
<xsl:template match=3D"document">
<html>
<head><title>Prueba de mono</title></head>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match=3D"para">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match=3D"paramref">
<i><xsl:value-of select=3D"@name"/>
<xsl:apply-templates/>
</i>
</xsl:template>
<xsl:template match=3D"example">
<pre>
<xsl:apply-templates/>
</pre>
</xsl:template>
=09
<xsl:template match=3D"see">
<xsl:choose>
<xsl:when test=3D"string-length(@langword)=3D0">
<a href=3D"{@cref}">
<xsl:call-template name=3D"string-replace">
<xsl:with-param name=3D"string" select=3D"@cref"/>
<xsl:with-param name=3D"from">.</xsl:with-param>
</xsl:call-template>
<xsl:call-template name=3D"string-addsignature">
<xsl:with-param name=3D"string" select=3D"@cref"/>
</xsl:call-template>
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:otherwise>
<a href=3D"{@langword}"><xsl:value-of select=3D"@langword"/></a>
</xsl:otherwise>
</xsl:choose> =20
</xsl:template>
=09
=09
</xsl:stylesheet>
--=-wcCHv8SFEInMicT1y3cY--