<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:msxsl="urn:schemas-microsoft-com:xslt"
+ exclude-result-prefixes="msxsl"
>
+ <xsl:import href="mdoc-html-format.xsl" />
<!-- TEMPLATE PARAMETERS -->
<xsl:param name="language" select="'C#'"/>
<xsl:param name="index" />
+ <xsl:param name="source-id"/>
<xsl:variable name="ThisType" select="/Type"/>
</xsl:for-each>
<a>
<xsl:attribute name="href">
- <xsl:call-template name="GetLinkTarget">
+ <xsl:call-template name="GetLinkTargetHtml">
<xsl:with-param name="type" select="@Type" />
<xsl:with-param name="cref">
<xsl:text>T:</xsl:text>
<xsl:param name="TypeParameters" />
<xsl:for-each select="$TypeParameters/TypeParameter">
- <xsl:if test="count(Constraints/*) > 0">
+ <xsl:variable name="constraintsCount" select="count(Constraints/*)" />
+ <xsl:if test="$constraintsCount > 0 and count(Constraints/*[.='Contravariant' or .='Covariant']) != $constraintsCount">
<xsl:call-template name="CreateGenericParameterConstraints">
<xsl:with-param name="constraints" select="Constraints" />
</xsl:call-template>
</xsl:template>
+ <xsl:template name="CreateRelatedSection">
+ <xsl:param name="section" />
+ <xsl:param name="type" />
+ <xsl:if test="count(Docs/related[@type=$type])">
+ <h3 class="{$type}"><xsl:value-of select="$section" /></h3>
+ <ul class="{$type}">
+ <xsl:for-each select="Docs/related[@type=$type]">
+ <li><a href="{@href}" target="_blank"><xsl:value-of select="." /></a></li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="CreatePlatformRequirements">
+ <!-- For now we only have that information in MonoTouch so only process that -->
+ <xsl:if test="starts-with(/Type/@FullName, 'MonoTouch')">
+ <xsl:choose>
+ <!-- We first check if we have a [Since] at the member level -->
+ <xsl:when test="count(Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')])">
+ <b>Minimum iOS version: </b>
+ <xsl:value-of select="translate(substring-before (substring-after (Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')], 'MonoTouch.ObjCRuntime.Since('), ')'), ', ', '.')" />
+ <br />
+ </xsl:when>
+ <!-- If not, we then check at the type level -->
+ <xsl:when test="count(/Type/Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')])">
+ <b>Minimum iOS version: </b>
+ <xsl:value-of select="translate(substring-before (substring-after (/Type/Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')], 'MonoTouch.ObjCRuntime.Since('), ')'), ', ', '.')" />
+ <br />
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
<xsl:template name="CreateMemberSignature">
<xsl:param name="linkid" select="''" />
</xsl:call-template>
</xsl:if>
- <!-- thread safety -->
-
- <xsl:if test="count(ThreadingSafetyStatement)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Thread Safety'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Thread Safety')" />
- <xsl:with-param name="content">
- <xsl:apply-templates select="ThreadingSafetyStatement" mode="notoppara"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
-
- <!-- permissions -->
+ <!-- method/property/constructor exceptions -->
- <xsl:if test="count(Docs/permission)">
+ <xsl:if test="count(Docs/exception)">
<xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Permissions'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Permissions')" />
+ <xsl:with-param name="name" select="'Exceptions'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Exceptions')" />
<xsl:with-param name="content">
<xsl:call-template name="CreateTypeDocumentationTable">
<xsl:with-param name="content">
- <xsl:for-each select="Docs/permission">
+ <xsl:for-each select="Docs/exception">
<tr valign="top">
<td>
<xsl:apply-templates select="@cref" mode="typelink">
<xsl:with-param name="wrt" select="$TypeNamespace"/>
</xsl:apply-templates>
- <xsl:apply-templates select="." mode="editlink"/>
</td>
<td>
<xsl:apply-templates select="." mode="notoppara"/>
+ <xsl:apply-templates select="." mode="editlink"/>
</td>
</tr>
</xsl:for-each>
</xsl:call-template>
</xsl:if>
- <!-- method/property/constructor exceptions -->
+ <!-- remarks -->
- <xsl:if test="count(Docs/exception)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Exceptions'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Exceptions')" />
+ <xsl:if test="count(Docs/remarks)">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Remarks'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Remarks')" />
+ <xsl:with-param name="content">
+ <xsl:apply-templates select="Docs/remarks" mode="notoppara"/>
+ <xsl:apply-templates select="Docs/remarks" mode="editlink"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- thread safety -->
+
+ <xsl:if test="count(ThreadingSafetyStatement)">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Thread Safety'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Thread Safety')" />
+ <xsl:with-param name="content">
+ <xsl:apply-templates select="ThreadingSafetyStatement" mode="notoppara"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+
+ <!-- permissions -->
+
+ <xsl:if test="count(Docs/permission)">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Permissions'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Permissions')" />
<xsl:with-param name="content">
<xsl:call-template name="CreateTypeDocumentationTable">
<xsl:with-param name="content">
- <xsl:for-each select="Docs/exception">
+ <xsl:for-each select="Docs/permission">
<tr valign="top">
<td>
<xsl:apply-templates select="@cref" mode="typelink">
<xsl:with-param name="wrt" select="$TypeNamespace"/>
</xsl:apply-templates>
+ <xsl:apply-templates select="." mode="editlink"/>
</td>
<td>
<xsl:apply-templates select="." mode="notoppara"/>
- <xsl:apply-templates select="." mode="editlink"/>
</td>
</tr>
</xsl:for-each>
</xsl:call-template>
</xsl:if>
- <!-- remarks -->
-
- <xsl:if test="count(Docs/remarks)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Remarks'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Remarks')" />
- <xsl:with-param name="content">
- <xsl:apply-templates select="Docs/remarks" mode="notoppara"/>
- <xsl:apply-templates select="Docs/remarks" mode="editlink"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
<!-- enumeration values -->
<xsl:if test="Base/BaseTypeName = 'System.Enum'">
- <xsl:call-template name="CreateH4Section">
+ <xsl:call-template name="CreateH2Section">
<xsl:with-param name="name" select="'Members'"/>
<xsl:with-param name="child-id" select="concat ($linkid, ':Members')" />
<xsl:with-param name="content">
<xsl:if test="count(Docs/example)">
<xsl:for-each select="Docs/example">
- <xsl:call-template name="CreateH4Section">
+ <xsl:call-template name="CreateH2Section">
<xsl:with-param name="name" select="'Example'"/>
<xsl:with-param name="child-id" select="concat ($linkid, ':Example:', position())" />
<xsl:with-param name="content">
</xsl:for-each>
</xsl:if>
- <xsl:call-template name="CreateH4Section">
+ <!-- related content -->
+ <xsl:if test="count(Docs/related)">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Related content'" />
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Related:')" />
+ <xsl:with-param name="content">
+ <div class="related">
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'Articles'" />
+ <xsl:with-param name="type" select="'article'" />
+ </xsl:call-template>
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'Recipes'" />
+ <xsl:with-param name="type" select="'recipe'" />
+ </xsl:call-template>
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'Samples'" />
+ <xsl:with-param name="type" select="'sample'" />
+ </xsl:call-template>
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'Related specifications'" />
+ <xsl:with-param name="type" select="'specification'" />
+ </xsl:call-template>
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'External Documentation'" />
+ <xsl:with-param name="type" select="'externalDocumentation'" />
+ </xsl:call-template>
+ </div>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:call-template name="CreateH2Section">
<xsl:with-param name="name" select="'Requirements'"/>
<xsl:with-param name="child-id" select="concat ($linkid, ':Version Information')" />
<xsl:with-param name="content">
+ <xsl:call-template name="CreatePlatformRequirements" />
<b>Namespace: </b><xsl:value-of select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)" />
<xsl:if test="count(/Type/AssemblyInfo/AssemblyName) > 0">
<br />
</xsl:call-template>
</xsl:template>
+ <xsl:template name="makenamespacelink">
+ <xsl:param name="cref" select="''"/>
+
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="GetLinkTargetHtml">
+ <xsl:with-param name="cref" select="$cref" />
+ </xsl:call-template>
+ </xsl:attribute>
+
+ <xsl:value-of select="substring-after ($cref, 'N:')" />
+ </a>
+ </xsl:template>
+
<xsl:template name="maketypelink">
<xsl:param name="type" select="'notset'"/>
<xsl:param name="wrt" select="'notset'"/>
<xsl:param name="nested" select="0"/>
- <xsl:param name="btype">
+ <xsl:variable name="btype">
<xsl:call-template name="ToBrackets">
<xsl:with-param name="s" select="$type" />
</xsl:call-template>
- </xsl:param>
+ </xsl:variable>
<xsl:variable name="array">
<xsl:call-template name="GetArraySuffix">
</xsl:call-template>
</xsl:when>
- <xsl:when test="$array">
+ <xsl:when test="string($array)">
<xsl:call-template name="maketypelink">
<xsl:with-param name="type" select="substring($type, 1, string-length($type) - string-length ($array))"/>
<xsl:with-param name="wrt" select="$wrt"/>
</xsl:variable>
<a>
<xsl:attribute name="href">
- <xsl:call-template name="GetLinkTarget">
+ <xsl:call-template name="GetLinkTargetHtml">
<xsl:with-param name="type" select="$escaped-type" />
<xsl:with-param name="cref" select="concat ('T:', $escaped-type)" />
</xsl:call-template>
</xsl:variable>
<a>
<xsl:attribute name="href">
- <xsl:call-template name="GetLinkTarget">
+ <xsl:call-template name="GetLinkTargetHtml">
<xsl:with-param name="type" select="$escaped-type" />
<xsl:with-param name="cref">
<xsl:call-template name="ToBraces">
<xsl:with-param name="content" select="string(descendant-or-self::text())" />
</xsl:call-template>
</xsl:template>
-
- <xsl:template match="onequarter">
- 1/4
+ <xsl:template match="img">
+ <p>
+ <img>
+ <xsl:attribute name="src">
+ <!-- we recognize two types of images:
+ - those with src attribute that reference directly an external image
+ - those with a href attributes which are internally available as part of the doc bundle
+ -->
+ <xsl:choose>
+ <xsl:when test="count(@src)>0">
+ <xsl:value-of select="@src" />
+ </xsl:when>
+ <xsl:when test="count(@href)>0">
+ <xsl:value-of select="concat('source-id:', $source-id, ':', @href)" />
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="count(@class)>0">
+ <xsl:value-of select="@class" />
+ </xsl:when>
+ <xsl:otherwise>picture</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </img>
+ </p>
</xsl:template>
- <xsl:template match="pi">pi</xsl:template>
- <xsl:template match="theta">theta</xsl:template>
+
+ <xsl:template match="onequarter">¼</xsl:template>
+ <xsl:template match="pi">π</xsl:template>
+ <xsl:template match="theta">θ</xsl:template>
+ <xsl:template match="leq">≤</xsl:template>
+ <xsl:template match="geq">≥</xsl:template>
<xsl:template match="subscript">
<sub><xsl:value-of select="@term"/></sub>
</xsl:template>
<xsl:with-param name="type" select="normalize-space (@cref)"/>
</xsl:call-template>
</xsl:when>
+ <xsl:when test="not(substring-after(@cref, 'N:')='')">
+ <xsl:call-template name="makenamespacelink">
+ <xsl:with-param name="cref" select="normalize-space (@cref)"/>
+ </xsl:call-template>
+ </xsl:when>
<xsl:otherwise>
<xsl:call-template name="makememberlink">
<xsl:with-param name="cref" select="normalize-space (@cref)"/>
</xsl:call-template>
</xsl:variable>
- <xsl:if test="not($basedocsfile='--not-available--')">
+ <xsl:if test="not(string($basedocsfile) = '')">
<xsl:call-template name="GetInheritedMembers">
<xsl:with-param name="listmembertype" select="$listmembertype"/>
<xsl:with-param name="showprotected" select="$showprotected"/>
- <xsl:with-param name="declaringtype" select="document($basedocsfile,.)/Type"/>
+ <xsl:with-param name="declaringtype" select="document(string($basedocsfile),.)/Type"/>
<xsl:with-param name="generictypereplacements" select="$declaringtype/Base/BaseTypeArguments/*"/>
<xsl:with-param name="showstatic" select='0'/>
</xsl:call-template>
<xsl:variable name="TypeName" select="@Name"/>
<xsl:variable name="TypeNamespace" select="substring-before(@FullName, concat('.',@Name))"/>
- <xsl:variable name="MEMBERS">
+ <xsl:variable name="MEMBERS-rtf">
<xsl:call-template name="GetInheritedMembers">
<xsl:with-param name="listmembertype" select="$listmembertype"/>
<xsl:with-param name="showprotected" select="$showprotected"/>
<xsl:with-param name="overloads-mode" select="$overloads-mode" />
</xsl:call-template>
</xsl:variable>
+ <xsl:variable name="MEMBERS" select="msxsl:node-set($MEMBERS-rtf)" />
<!--
<xsl:variable name="MEMBERS" select="
-->
<!-- if there aren't any, skip this -->
- <xsl:if test="count($MEMBERS/Member)">
+ <xsl:if test="count($MEMBERS//Member)">
<xsl:variable name="SectionName">
<xsl:if test="$listmembertype != 'Explicit' and $listmembertype != 'ExtensionMethod'">
</xsl:variable>
<!-- header -->
- <xsl:call-template name="CreateH3Section">
+ <xsl:call-template name="CreateH2Section">
<xsl:with-param name="name" select="$SectionName" />
<xsl:with-param name="child-id" select="$SectionName" />
<xsl:with-param name="content">
<xsl:call-template name="CreateMembersTable">
<xsl:with-param name="content">
- <xsl:for-each select="$MEMBERS/Member">
+ <xsl:for-each select="$MEMBERS/Members/Member">
<!--<xsl:sort select="contains(MemberSignature[@Language='C#']/@Value,' static ')" data-type="text"/>-->
<xsl:sort select="@MemberName = 'op_Implicit' or @MemberName = 'op_Explicit'"/>
<xsl:sort select="@ExplicitMemberName" data-type="text"/>
</xsl:choose>
</xsl:variable>
- <xsl:variable name="linkid">
+ <xsl:variable name="linkfile">
<xsl:if test="not(parent::Members/@FullName = $TypeFullName)">
- <xsl:call-template name="GetLinkTarget">
+ <xsl:call-template name="GetLinkTargetHtml">
<xsl:with-param name="type">
<xsl:choose>
<xsl:when test="count(Link) = 1">
<xsl:with-param name="cref" />
</xsl:call-template>
</xsl:if>
+ </xsl:variable>
+
+ <xsl:variable name="linkid">
<xsl:if test="$html-anchor">
+ <xsl:value-of select="$linkfile" />
<xsl:text>#</xsl:text>
</xsl:if>
<xsl:value-of select="$local-id" />
<xsl:param name="arglist" />
<xsl:param name="count" />
- <xsl:variable name="rest">
+ <xsl:variable name="rest-rtf">
<xsl:call-template name="SkipTypeArgument">
<xsl:with-param name="s" select="$arglist" />
</xsl:call-template>
</xsl:variable>
+ <xsl:variable name="rest" select="string($rest-rtf)" />
<xsl:choose>
<xsl:when test="$arglist != '' and $rest = ''">
<xsl:template name="SkipTypeArgument">
<xsl:param name="s" />
- <xsl:variable name="p">
+ <xsl:variable name="p-rtf">
<xsl:call-template name="GetCLtGtPositions">
<xsl:with-param name="s" select="$s" />
</xsl:call-template>
</xsl:variable>
+ <xsl:variable name="p" select="msxsl:node-set($p-rtf)"/>
<xsl:choose>
<!--
<xsl:with-param name="s" select="substring-after ($s, '<')" />
</xsl:call-template>
</xsl:variable>
- <xsl:value-of select="substring-after ($r, '>')" />
+ <xsl:choose>
+ <xsl:when test="starts-with ($r, '>') or starts-with ($r, '+')">
+ <xsl:value-of select="substring-after ($r, '>')" />
+ </xsl:when>
+ <xsl:when test="starts-with ($r, ',')">
+ <xsl:value-of select="$r" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+! WTF3: s=<xsl:value-of select="$s" />; r=<xsl:value-of select="$r" />
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:when test="$p/Gt/@Length > 0">
<xsl:text>></xsl:text>
<xsl:variable name="lt" select="substring-before ($s, '<')" />
<xsl:variable name="gt" select="substring-before ($s, '>')" />
- <Positions>
<Comma String="{$c}" Length="{string-length ($c)}" />
<Lt String="{$lt}" Length="{string-length ($lt)}" />
<Gt String="{$gt}" Length="{string-length ($gt)}" />
- </Positions>
</xsl:template>
<!--
<xsl:template name="SkipGenericArgument">
<xsl:param name="s" />
- <xsl:variable name="p">
+ <xsl:variable name="p-rtf">
<xsl:call-template name="GetCLtGtPositions">
<xsl:with-param name="s" select="$s" />
</xsl:call-template>
</xsl:variable>
+ <xsl:variable name="p" select="msxsl:node-set($p-rtf)" />
<xsl:choose>
<xsl:when test="starts-with ($s, '>')">
<xsl:with-param name="type" select="$type" />
<xsl:with-param name="member" select="$member" />
</xsl:call-template>
- <xsl:if test="count($member/Parameters/Parameter) > 0">
+ <xsl:if test="count($member/Parameters/Parameter) > 0 or $member/MemberType='Method' or $member/MemberType='Constructor'">
<xsl:text>(</xsl:text>
<xsl:for-each select="Parameters/Parameter">
<xsl:if test="not(position()=1)">,</xsl:if>
</xsl:if>
<xsl:if test="$member/@MemberName='op_Implicit' or $member/@MemberName='op_Explicit'">
<xsl:text>~</xsl:text>
+ <xsl:variable name="parameter-rtf">
+ <Parameter Type="{$member/ReturnValue/ReturnType}" />
+ </xsl:variable>
<xsl:call-template name="GetParameterType">
<xsl:with-param name="type" select="$type" />
<xsl:with-param name="member" select="$member" />
- <xsl:with-param name="parameter">
- <Parameter Type="{$member/ReturnValue/ReturnType}" />
- </xsl:with-param>
+ <xsl:with-param name="parameter" select="msxsl:node-set($parameter-rtf)/Parameter" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</p>
</xsl:template>
+ <xsl:template name="GetLinkTargetHtml">
+ <xsl:param name="type" />
+ <xsl:param name="cref" />
+
+ <xsl:variable name="href">
+ <xsl:call-template name="GetLinkTarget">
+ <xsl:with-param name="type" select="$type" />
+ <xsl:with-param name="cref" select="$cref" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string($href) = ''">
+ <xsl:text>javascript:alert("Documentation not found.")</xsl:text>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$href" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
</xsl:stylesheet>