[Mono-list] Help needed with XSLT:

Peter Williams peterw@ximian.com
18 Jan 2003 15:40:46 -0500

Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sat, 2003-01-18 at 15:02, Miguel de Icaza wrote:
> Hey guys,
>    I posted this to the docs mailing list, but got no input so far. 
> Anyone could help us with this?
> Miguel

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.

Peter Williams     peter@newton.cx / peterw@ximian.com

"[Ninjas] are cool; and by cool, I mean totally sweet."
                              -- REAL Ultimate Power

Content-Disposition: attachment; filename=Test.xml
Content-Type: text/xml; name=Test.xml; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

      <para>This is some stuff</para>
      <para>With <child>sub</child> elements</para>
      <para>Also, see <see cref="Foo.Bar.Bam"/> too</para>
      <para>Also, <paramref name="bob"/> is cool too.</para>

Content-Disposition: attachment; filename=monodoc.xsl
Content-Type: text/plain; name=monodoc.xsl; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE xsl:stylesheet>


  <xsl:output method="xml"/>

  <!-- Basically, copy the entire tree, except for:
      	* para -> p
	* see -> a href
	* paramref -> i -->

  <xsl:template match="@*|node()">
      <xsl:apply-templates select="@*|node()"/>

  <xsl:template match="para">
      <xsl:apply-templates select="@*|node()"/>

  <xsl:template match="see">
    <a href="{@cref}"><xsl:value-of select="@cref"/></a>

  <xsl:template match="paramref">
    <i><xsl:value-of select="@name"/></i>