Project

General

Profile

1 3032 perry
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0"
3
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
  xmlns:out="http://www.w3.org/dummyXSL" >
6
7
<!--
8
Description: Generate the component register from the config XML schema.
9 4307 leinfelder
Author:      Mike Adair / Gertjan van Oosten
10 3032 perry
Licence:     LGPL as per: http://www.gnu.org/copyleft/lesser.html
11
12 4307 leinfelder
$Id: ObjectList.xsl 3094 2007-08-09 12:29:59Z gjvoosten $
13 3032 perry
-->
14
15
  <xsl:output method="xml" encoding="utf-8" indent="yes"/>
16
17
  <xsl:param name="widgetId"/>
18 4307 leinfelder
  <xsl:param name="listType"/>
19 3032 perry
  <xsl:param name="subType"/>
20 4307 leinfelder
  <xsl:param name="excludeType"/>
21 3032 perry
22
  <xsl:variable name="docRoot" select="/xs:schema"/>
23
24 4307 leinfelder
  <xsl:template match="/xs:schema">
25 3032 perry
    <dl>
26
      <xsl:for-each select="xs:complexType[@name=$listType]/xs:choice/*">
27
        <xsl:variable name="typeName" select="substring-after(@type,':')"/>
28
        <xsl:variable name="typeDef" select="$docRoot/xs:complexType[@name=$typeName]"/>
29 4307 leinfelder
        <xsl:choose>
30
        <xsl:when test="string-length($subType)=0 or $typeName=substring-after($subType,':') or $typeDef/xs:complexContent/xs:extension/@base=$subType">
31 3032 perry
          <dt><a href="javascript:config.objects.{$widgetId}.showDetails('{$typeName}')"><xsl:value-of select="@name"/></a></dt>
32
          <dd><xsl:value-of select="$typeDef/xs:annotation/xs:documentation"/></dd>
33 4307 leinfelder
        </xsl:when>
34
        <xsl:otherwise>
35
          <xsl:call-template name="findSubType">
36
            <xsl:with-param name="typeName" select="$typeName"/>
37
            <xsl:with-param name="typeDesc" select="$typeDef/xs:annotation/xs:documentation"/>
38
            <xsl:with-param name="typeBase" select="$typeName"/>
39
          </xsl:call-template>
40
        </xsl:otherwise>
41
        </xsl:choose>
42 3032 perry
      </xsl:for-each>
43
    </dl>
44 4307 leinfelder
  </xsl:template>
45
46
  <xsl:template name="findSubType">
47
    <xsl:param name="typeName"/>
48
    <xsl:param name="typeDesc"/>
49
    <xsl:param name="typeBase"/>
50
    <xsl:variable name="typeDef" select="$docRoot/xs:complexType[@name=$typeBase]"/>
51
    <xsl:if test="$typeBase and $typeBase!=substring-after($excludeType,':')">
52
      <xsl:choose>
53
        <xsl:when test="$typeDef/xs:complexContent/xs:extension/@base=$subType">
54
          <dt><a href="javascript:config.objects.{$widgetId}.showDetails('{$typeName}')"><xsl:value-of select="@name"/></a></dt>
55
          <dd><xsl:value-of select="$typeDesc"/></dd>
56
        </xsl:when>
57
        <xsl:otherwise>
58
          <xsl:call-template name="findSubType">
59
            <xsl:with-param name="typeName" select="$typeName"/>
60
            <xsl:with-param name="typeDesc" select="$typeDesc"/>
61
            <xsl:with-param name="typeBase" select="substring-after($typeDef/xs:complexContent/xs:extension/@base,':')"/>
62
          </xsl:call-template>
63
        </xsl:otherwise>
64
      </xsl:choose>
65
    </xsl:if>
66
  </xsl:template>
67 3032 perry
68
  <xsl:template match="text()|@*"/>
69
70
</xsl:stylesheet>