001 <?xml version="1.0" encoding="ISO-8859-1"?> 002 <?xml-stylesheet type="text/xsl" href="xsl.xsl"?> 003 004 <!-- 005 - Copyright 2005-2006 Jens Voß. 006 - 007 - Licensed under the GNU Lesser General Public License (the "License"); 008 - you may not use this file except in compliance with the License. 009 - You may obtain a copy of the License at 010 - 011 - http://opensource.org/licenses/lgpl-license.php 012 - 013 - Unless required by applicable law or agreed to in writing, software 014 - distributed under the License is distributed on an "AS IS" BASIS, 015 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 - See the License for the specific language governing permissions and 017 - limitations under the License. 018 - 019 --> 020 021 <!--- 022 - The 'patterns.xsl' stylesheet is used to extract XPath patterns 023 - used in <code>@see</code>, <code>{@literal {@link}}</code> and 024 - <code>{@literal {@linkplain}}</code> tags. The XPath patterns 025 - are identified by a double hash character ('<code>##</code>') 026 - separating the (optional) source file and anchor in the link. 027 - This stylesheet constructs an XML result tree and therefore needs 028 - to "override" a few templates "inherited" from its "ancestor" 029 - stylesheets which insert HTML elements into the result tree. 030 - 031 - @author Jens Voß 032 - @since 0.6 033 - @version 0.6 034 --> 035 <xsl:stylesheet version='1.0' 036 xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> 037 038 <xsl:import href="content-page.xsl"/> 039 040 <xsl:output method="xml"/> 041 042 043 <!--- 044 - This template "overrides" the {@linkplain base-page.xsl##/*/*[@match = '/'] 045 - root template} defined in the <code>base-page.xsl</code> stylesheet. 046 --> 047 <xsl:template match="/"> 048 <patterns> 049 <xsl:apply-templates select="/*" mode="contentPage.renderDetails"/> 050 </patterns> 051 </xsl:template> 052 053 054 <!--- 055 - This template "implements" the "abstract" template defined in 056 - <code>content-page.xsl</code>. 057 --> 058 <xsl:template match="/*" mode="contentPage.getMemberNames"> 059 <xsl:apply-templates select="." mode="util.postprocessMemberNames"> 060 <xsl:with-param name="memberNames">**</xsl:with-param> 061 </xsl:apply-templates> 062 </xsl:template> 063 064 065 <!--- 066 - This template "overrides" the {@linkplain content-page.xsl##/*/*[@mode = 067 - 'contentPage.renderMembersDetailsGroup'] template with 068 - <code>mode="contentPage.renderMembersDetailsGroup"</code>} defined in 069 - <code>content-page.xsl</code>. The "parent" template inserts HTML tags 070 - into the result tree which is eliminated in this "implementation". 071 --> 072 <xsl:template match="/*" mode="contentPage.renderMembersDetailsGroup"> 073 <xsl:param name="memberNames"/> 074 <xsl:apply-templates select="/*" mode="contentPage.renderMembersDetailsGroupBody"> 075 <xsl:with-param name="memberNames"> 076 <xsl:choose> 077 <xsl:when test="contains($memberNames, '#')"> 078 <xsl:value-of select="substring-after($memberNames, '#')"/> 079 </xsl:when> 080 <xsl:otherwise> 081 <xsl:value-of select="$memberNames"/> 082 </xsl:otherwise> 083 </xsl:choose> 084 </xsl:with-param> 085 </xsl:apply-templates> 086 </xsl:template> 087 088 089 <!--- 090 - This template "overrides" the {@linkplain content-page.xsl##/*/*[@mode = 091 - 'contentPage.renderMemberDetails'] template with 092 - <code>mode="contentPage.renderMemberDetails"</code>} defined in 093 - <code>content-page.xsl</code>. The "parent" template inserts HTML tags 094 - into the result tree which is eliminated in this "implementation". 095 --> 096 <xsl:template match="/|*" mode="contentPage.renderMemberDetails"> 097 098 <xsl:variable name="xdcText"> 099 <xsl:apply-templates select="/" mode="comments.getXdcComment"> 100 <xsl:with-param name="node" select="."/> 101 </xsl:apply-templates> 102 </xsl:variable> 103 104 <xsl:apply-templates select="/" mode="comments.getXdcBody"> 105 <xsl:with-param name="text" select="$xdcText"/> 106 <xsl:with-param name="package" select="$package"/> 107 </xsl:apply-templates> 108 109 <xsl:apply-templates select="/" mode="comments.displayXdcTags"> 110 <xsl:with-param name="text" select="$xdcText"/> 111 <xsl:with-param name="tagNames"> 112 <xsl:apply-templates select="." mode="basePage.getXdcTagNames"/> 113 </xsl:with-param> 114 <xsl:with-param name="package" select="$package"/> 115 </xsl:apply-templates> 116 117 </xsl:template> 118 119 120 <!--- 121 - This template "overrides" the {@linkplain comments.xsl##/*/*[@mode = 122 - 'comments.displayXdcTag'] template with <code>mode="comments.displayXdcTag"</code>} 123 - defined in the <code>comments.xsl</code> stylesheet. The "parent" template inserts 124 - HTML tags into the result tree which is eliminated in this "implementation". 125 --> 126 <xsl:template match="/" mode="comments.displayXdcTag"> 127 <xsl:param name="text"/> 128 <xsl:param name="tagName"/> 129 <xsl:apply-templates select="/" mode="comments.getXdcTag"> 130 <xsl:with-param name="text" select="$text"/> 131 <xsl:with-param name="tagName" select="$tagName"/> 132 </xsl:apply-templates> 133 </xsl:template> 134 135 136 <!--- 137 - This template "overrides" the {@linkplain base-page.xsl##/*/*[@mode = 138 - 'basePage.renderXdcTag'] template with <code>mode="basePage.renderXdcTag"</code>} 139 - defined in <code>base-page.xsl</code>. The "parent" template inserts HTML tags 140 - into the result tree which is eliminated in this "implementation". 141 --> 142 <xsl:template match="/" mode="basePage.renderXdcTag"> 143 <xsl:param name="tagName"/> 144 <xsl:param name="tagValue"/> 145 <xsl:choose> 146 <xsl:when test="$tagName = 'see'"> 147 <xsl:apply-templates select="/" mode="patterns.getPattern"> 148 <xsl:with-param name="text" select="concat('@see ', $tagValue, '}')"/> 149 <xsl:with-param name="tagText">@see</xsl:with-param> 150 </xsl:apply-templates> 151 </xsl:when> 152 <xsl:otherwise> 153 <xsl:apply-templates select="/" mode="patterns.getPattern"> 154 <xsl:with-param name="text" select="$tagValue"/> 155 </xsl:apply-templates> 156 </xsl:otherwise> 157 </xsl:choose> 158 </xsl:template> 159 160 161 <!--- 162 - This template "overrides" the {@linkplain comments.xsl##/*/*[@mode = 163 - 'comments.resolveInlineTags'] template with <code>mode="comments.resolveInlineTags"</code>} 164 - defined in the <code>comments.xsl</code>. The "parent" template inserts HTML tags 165 - into the result tree which is eliminated in this "implementation". 166 --> 167 <xsl:template match="/" mode="comments.resolveInlineTags"> 168 <xsl:param name="text"/> 169 <xsl:apply-templates select="/" mode="patterns.getPattern"> 170 <xsl:with-param name="text" select="$text"/> 171 </xsl:apply-templates> 172 </xsl:template> 173 174 175 <!--- 176 - This template is responsible for extracting one (or - by recursive 177 - invocation - more) <code><pattern></code> elements from a text 178 - containing one (or more) links with XPath patterns as anchors. 179 --> 180 <xsl:template match="/" mode="patterns.getPattern"> 181 <xsl:param name="text"/> 182 <xsl:param name="tagText">{@link</xsl:param> 183 <xsl:if test="contains($text, $tagText)"> 184 <xsl:variable name="inlineTag" select="substring-before(substring-after(normalize-space($text), $tagText), '}')"/> 185 <xsl:if test="contains($inlineTag, '##')"> 186 <pattern> 187 <file> 188 <xsl:value-of select="substring-after(substring-before($inlineTag, '##'), ' ')"/> 189 </file> 190 <xsl:variable name="remaining" select="substring-after(substring-after($text, $tagText), '##')"/> 191 <xsl:variable name="length"> 192 <xsl:apply-templates select="/" mode="util.findEnd"> 193 <xsl:with-param name="text" select="normalize-space($remaining)"/> 194 </xsl:apply-templates> 195 </xsl:variable> 196 <xpath> 197 <xsl:value-of select="substring(normalize-space($remaining), 1, $length)"/> 198 </xpath> 199 </pattern> 200 </xsl:if> 201 <xsl:apply-templates select="/" mode="comments.resolveInlineTags"> 202 <xsl:with-param name="text" select="substring-after($text, '}')"/> 203 </xsl:apply-templates> 204 </xsl:if> 205 </xsl:template> 206 207 </xsl:stylesheet>