Project

Profile

Help

How to connect?
Download (1.55 KB) Statistics
| Branch: | Tag: | Revision:

he / tools / dotnet / tojava.xsl @ 5d25f10d

1
<xsl:stylesheet version="2.0" 
2
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
   xmlns:xs="http://www.w3.org/2001/XMLSchema">
4
   
5
   <!-- This was an experimental stylesheet trying to convert the .NET code to Java 
6
        so that Javadoc could be used to generate the documentation -->
7
   
8
<xsl:output method="text"/>
9

    
10
<xsl:variable name="names-doc" select="doc('names.xml')"/> 
11
<xsl:variable name="api-doc" select="/"/> 
12

    
13
<xsl:key name="n-class-by-name" match="interface | class | enum" use="@name"/>
14

    
15
<xsl:key name="a-class-by-name" match="member[startswith(@name, 'T:')]
16
      
17
<xsl:template match="/">
18
  <xsl:apply-templates select="$names-doc/package/*"/>
19
</xsl:template>   
20

    
21
<xsl:template match="class | interface | enum">
22
  <xsl:variable name="shortname" select="@name"/>
23
  <xsl:variable name="fullname" select="concat('Saxon.Api.', $shortname)"/>
24
  <xsl:result-document href="{static-base-uri()}/src/{replace($fullname, '.', '/')}.java">
25
    <xsl:text>package Saxon.Api;&#xa;</xsl:text>
26
    <xsl:text>&#xa;</xsl:text>
27
    <xsl:if test="@public = 'true'">public </xsl:if>
28
    <xsl:if test="@abstract = 'true'">abstract </xsl:if>
29
    <xsl:value-of select="name()"/>
30
    <xsl:if test="string(@base)">
31
      <xsl:variable name="class" select="key('n-class-by-name')"/>
32
      <xsl:choose>
33
        <xsl:when test="$class/self::class"> extends </xsl:when>
34
        <xsl:otherwise> implements </xsl:otherwise>
35
      </xsl:choose>
36
      <xsl:value-of select="@base"/>
37
    <xsl:text> {&#xa;</xsl:text>
38
    <xsl:apply-templates select="*"/>
39
  </xsl:result-document>
40
</xsl:template>
41
   
42
 
(7-7/7)