[Mono-list] Help needed with XSLT:
Jorge Pérez Burgos (Koke)
koke@eresmas.net
18 Jan 2003 23:09:15 +0100
--=-PzhynMYepVZ7gJmPQTQh
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
>
> I have to leave now but I think this should do the job? Attached is the
> template and a test file that I used. Note it doesn't munge the text in
> <see> correctly; there are string routines but I don't have time to look
> them up.
>
Perhaps the next example could be useful.
--=-PzhynMYepVZ7gJmPQTQh
Content-Disposition: attachment; filename=mono.xml
Content-Transfer-Encoding: quoted-printable
Content-Type: text/xml; charset=ISO-8859-15
<?xml version=3D"1.0"?>
<document>
<para>The format specification in <paramref name=3D"format" /> is invalid.=
</para>
<para>-or-</para>
<para>The number indicating an argument to be formatted is less t=
han zero, or greater than or equal to the number of provided objects to be =
formatted (3).</para>
<remarks>
<para>This version of <see cref=3D"M:System.IO.TextWriter.WriteLi=
ne" /> is equivalent to <see cref=3D"M:System.IO.TextWriter.WriteLine" qual=
ify=3D"true" />(<see cref=3D"M:System.String.Format(System.String,System.Ob=
ject)" qualify=3D"true" /> (<paramref name=3D"format" />,
<paramref name=3D"arg0" />, <paramref name=3D"arg1" />, <paramref name=3D"a=
rg2" />)).</para>
<block subset=3D"none" type=3D"note">
<para>If the specified object is not referenced in the format s=
tring, it is
ignored.</para>
<para>This method does not search the specified <see cref=3D"T:=
System.String" /> for individual newline characters
(hexadecimal 0x000a) and replace them with <see cref=3D"P:System.IO.Text=
Writer.NewLine" />.</para>
</block>
<para>
<block subset=3D"none" type=3D"behaviors">As
described above.</block>
</para>
</remarks>
</document>
--=-PzhynMYepVZ7gJmPQTQh
Content-Disposition: attachment; filename=mono.xsl
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-15
<?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>
=09
<xsl:template match=3D"see">
<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>
=20
<xsl:call-template name=3D"string-addsignature">
<xsl:with-param name=3D"string" select=3D"@cref"/>
</xsl:call-template>
=20
<xsl:apply-templates/>
</a>
</xsl:template>
=09
=09
</xsl:stylesheet>
--=-PzhynMYepVZ7gJmPQTQh--