jdk/test/javax/xml/jaxp/parsers/8022548/JDK8022548.xsl
changeset 19383 c27d061358c5
equal deleted inserted replaced
19382:fdb8e07fdaee 19383:c27d061358c5
       
     1 <?xml version="1.0" encoding='UTF-8'?>
       
     2 
       
     3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       
     4                 version="1.0"
       
     5                 xmlns:my="http://www.jenitennison.com/"
       
     6                 xmlns="http://www.w3.org/1999/xhtml"
       
     7                 xmlns:html="http://www.w3.org/1999/xhtml"
       
     8                 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       
     9                 xmlns:dc="http://purl.org/dc/elements/1.1/"
       
    10                 xmlns:dcq="http://purl.org/dc/qualifiers/1.0/"
       
    11                 xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt"
       
    12                 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
       
    13                 exclude-result-prefixes="rdf dc dcq my html vcf msxsl">
       
    14 
       
    15 <xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
       
    16             cdata-section-elements="script"
       
    17             indent="no"
       
    18             method="xml"
       
    19             encoding='UTF-8'/>
       
    20 
       
    21 <xsl:param name="dynamic" select="'true'" />
       
    22 <xsl:param name="base" select="'/'" />
       
    23 
       
    24 <xsl:variable name="supports-document" select="function-available('document')" />
       
    25 <xsl:variable name="supports-keys" select="function-available('key')" />
       
    26 
       
    27 <xsl:variable name="default-title" select='"Jeni&apos;s XML Site"' />
       
    28 
       
    29 <xsl:template match="my:doc">
       
    30   <xsl:variable name="metadata" select="/*/rdf:RDF" />
       
    31   <xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
       
    32 	<html>
       
    33 		<head>
       
    34 			<title>
       
    35 				<xsl:call-template name="get-metadata">
       
    36 					<xsl:with-param name="what" select="'title'" />
       
    37 				  <xsl:with-param name="about" select="$uri" />
       
    38 				</xsl:call-template>
       
    39 			</title>
       
    40 			<xsl:call-template name="get-metadata">
       
    41 				<xsl:with-param name="what" select="'link'" />
       
    42 				<xsl:with-param name="about" select="$uri" />
       
    43 			</xsl:call-template>
       
    44 			<link rel="alternate" type="text/xml" href="{$uri}" />
       
    45 			<xsl:call-template name="get-metadata">
       
    46 			  <xsl:with-param name="what" select="'rights'" />
       
    47 			  <xsl:with-param name="about" select="$uri" />
       
    48 			</xsl:call-template>
       
    49 		</head>
       
    50 		<body>
       
    51 			<xsl:if test="$dynamic = 'false'">
       
    52 				<p id="xml-link">
       
    53 					Try the <a href="{$uri}">XML version</a> of this page.
       
    54 					If you have problems with it, consult the
       
    55 					<a href="/compatibility.html">compatibility page</a>.
       
    56 				</p>
       
    57 			</xsl:if>
       
    58 			<xsl:apply-templates />
       
    59 			<xsl:apply-templates select="." mode="colophon" />
       
    60 		</body>
       
    61 	</html>
       
    62 </xsl:template>
       
    63 
       
    64 <xsl:template match="html:h1">
       
    65   <h1>
       
    66     <xsl:apply-templates />
       
    67     <xsl:call-template name="insert-navigation" />
       
    68   </h1>
       
    69 </xsl:template>
       
    70 
       
    71 <xsl:template name="insert-navigation">
       
    72   <xsl:variable name="metadata" select="/*/rdf:RDF" />
       
    73   <xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
       
    74 	<xsl:if test="$uri != concat($base, 'index.xml')">
       
    75 	<span id="link-top">
       
    76 		<a class="img">
       
    77 		  <xsl:attribute name="href">
       
    78 			  <xsl:choose>
       
    79 			    <xsl:when test="$dynamic = 'true'">/index.xml</xsl:when>
       
    80 
       
    81 			    <xsl:otherwise>/index.html</xsl:otherwise>
       
    82 			  </xsl:choose>
       
    83 		  </xsl:attribute>
       
    84 			<img src="{$base}resources/icons/top.gif" width="29" height="29" />
       
    85 		</a>
       
    86 	</span>
       
    87   <span id="link-up">
       
    88 		<a class="img">
       
    89 			<xsl:attribute name="href">
       
    90 				<xsl:choose>
       
    91 					<xsl:when test="contains($uri, 'index.xml')">
       
    92 					  <xsl:choose>
       
    93 					    <xsl:when test="$dynamic = 'true'">../index.xml</xsl:when>
       
    94 					    <xsl:otherwise>../index.html</xsl:otherwise>
       
    95 					  </xsl:choose>						  
       
    96 					</xsl:when>
       
    97 					<xsl:otherwise>
       
    98 					  <xsl:choose>
       
    99 					    <xsl:when test="$dynamic = 'true'">index.xml</xsl:when>
       
   100 					    <xsl:otherwise>index.html</xsl:otherwise>
       
   101 					  </xsl:choose>
       
   102 					</xsl:otherwise>
       
   103 				</xsl:choose>
       
   104 			</xsl:attribute>
       
   105 			<img src="{$base}resources/icons/up.gif" width="29" height="29" />
       
   106 		</a>
       
   107   </span>
       
   108 </xsl:if>
       
   109 </xsl:template>
       
   110 
       
   111 
       
   112 <xsl:template match="rdf:RDF" />
       
   113 
       
   114 <xsl:template name="get-metadata">
       
   115 	<xsl:param name="what" />
       
   116 	<xsl:param name="about" select="/*/rdf:RDF/rdf:Description/@about" />
       
   117   <xsl:variable name="metadata" select="/*/rdf:RDF" />
       
   118 	<xsl:variable name="type">
       
   119 		<xsl:choose>
       
   120 			<xsl:when test="contains($what, '::')">
       
   121 				<xsl:value-of select="substring-before($what, '::')" />
       
   122 			</xsl:when>
       
   123 			<xsl:otherwise><xsl:value-of select="$what" /></xsl:otherwise>
       
   124 		</xsl:choose>
       
   125 	</xsl:variable>
       
   126 	<xsl:variable name="mode">
       
   127 		<xsl:choose>
       
   128 			<xsl:when test="contains($what, '::')">
       
   129 				<xsl:value-of select="substring-after($what, '::')" />
       
   130 			</xsl:when>
       
   131 			<xsl:otherwise />
       
   132 		</xsl:choose>
       
   133 	</xsl:variable>
       
   134 	<xsl:apply-templates select="$metadata/rdf:Description[@about = $about or
       
   135 	                                                       (@aboutEachPrefix != '' and starts-with($about, @aboutEachPrefix))]/*[local-name() = $type]">
       
   136 		<xsl:with-param name="mode" select="$mode" />
       
   137 	</xsl:apply-templates>
       
   138 </xsl:template>
       
   139 
       
   140 <xsl:template match="rdf:Description/*">
       
   141 	<xsl:param name="mode" />
       
   142 	<xsl:choose>
       
   143 		<xsl:when test="@rdf:resource != ''">
       
   144 			<xsl:call-template name="get-metadata">
       
   145 				<xsl:with-param name="about" select="@rdf:resource" />
       
   146 				<xsl:with-param name="what" select="$mode" />
       
   147 			</xsl:call-template>
       
   148 		</xsl:when>
       
   149 		<xsl:when test="$mode = '' and @rdf:value != ''">
       
   150 			<xsl:value-of select="@rdf:value" />
       
   151 		</xsl:when>
       
   152 		<xsl:when test="$mode = '' and *">
       
   153 			<xsl:apply-templates />
       
   154 		</xsl:when>
       
   155 		<xsl:otherwise>
       
   156 			<xsl:apply-templates select="." mode="get-metadata">
       
   157 				<xsl:with-param name="mode" select="$mode" />
       
   158 			</xsl:apply-templates>
       
   159 		</xsl:otherwise>
       
   160 	</xsl:choose>
       
   161 </xsl:template>
       
   162 
       
   163 <xsl:template match="html:link" mode="get-metadata">
       
   164 	<link>
       
   165 		<xsl:copy-of select="@*" />
       
   166 	</link>
       
   167 </xsl:template>
       
   168 
       
   169 <xsl:template match="dc:rights" mode="get-metadata">
       
   170   <xsl:comment>
       
   171     <xsl:value-of select="." />
       
   172   </xsl:comment>
       
   173 </xsl:template>
       
   174 
       
   175 <xsl:template match="dc:date" mode="get-metadata">
       
   176 	<xsl:param name="mode" select="''" />
       
   177 	<xsl:if test="$mode = @dcq:dateType">
       
   178 		<xsl:value-of select="@rdf:value" />
       
   179 	</xsl:if>
       
   180 </xsl:template>
       
   181 
       
   182 <xsl:template match="vcf:vCard" mode="get-metadata">
       
   183 	<xsl:param name="mode" select="''" />
       
   184 	<xsl:choose>
       
   185 		<xsl:when test="$mode = 'mailto-link'">
       
   186 			<xsl:call-template name="link">
       
   187 				<xsl:with-param name="link">
       
   188 					<xsl:choose>
       
   189 						<xsl:when test="vcf:email[contains(@email.type, 'PREF')]">
       
   190 							<xsl:value-of select="vcf:email[contains(@email.type, 'PREF')]" />
       
   191 						</xsl:when>
       
   192 						<xsl:otherwise><xsl:value-of select="vcf:email[1]" /></xsl:otherwise>
       
   193 					</xsl:choose>
       
   194 				</xsl:with-param>
       
   195 				<xsl:with-param name="value">
       
   196 					<xsl:apply-templates select="vcf:n" mode="full" />
       
   197 				</xsl:with-param>
       
   198 			</xsl:call-template>
       
   199 		</xsl:when>
       
   200 		<xsl:when test="$mode = 'name'">
       
   201 			<xsl:apply-templates select="vcf:n" mode="full" />
       
   202 		</xsl:when>
       
   203 		<xsl:otherwise />
       
   204 	</xsl:choose>
       
   205 </xsl:template>
       
   206 
       
   207 <xsl:template match="vcf:n" mode="full">
       
   208 	<xsl:if test="vcf:prefix">
       
   209 		<xsl:value-of select="vcf:prefix" /><xsl:text> </xsl:text>
       
   210 	</xsl:if>
       
   211 	<xsl:choose>
       
   212 		<xsl:when test="../vcf:nickname">
       
   213 			<xsl:value-of select="../vcf:nickname" />
       
   214 		</xsl:when>
       
   215 		<xsl:otherwise>
       
   216 			<xsl:value-of select="vcf:given" />
       
   217 		</xsl:otherwise>
       
   218 	</xsl:choose>
       
   219 	<xsl:text> </xsl:text>
       
   220 	<xsl:value-of select="vcf:family" />
       
   221 </xsl:template>
       
   222 
       
   223 <xsl:template match="html:*">
       
   224 	<xsl:element name="{local-name()}">
       
   225 		<xsl:copy-of select="@*" />
       
   226 		<xsl:apply-templates />
       
   227 	</xsl:element>
       
   228 </xsl:template>
       
   229 
       
   230 <xsl:template match="my:vars">
       
   231   <dl>
       
   232     <xsl:apply-templates />
       
   233   </dl>
       
   234 </xsl:template>
       
   235 
       
   236 <xsl:template match="my:var">
       
   237   <dt id="{translate(my:name, ' ', '-')}">
       
   238     <xsl:text/>$<xsl:value-of select="my:name" />
       
   239     <xsl:choose>
       
   240       <xsl:when test="my:value">
       
   241         <xsl:text/> = <xsl:apply-templates select="my:value" />
       
   242       </xsl:when>
       
   243       <xsl:when test="my:default">
       
   244         <xsl:text/> [= <xsl:apply-templates select="my:default" />]<xsl:text/>
       
   245       </xsl:when>
       
   246     </xsl:choose>
       
   247   </dt>
       
   248   <dd>
       
   249     <xsl:if test="my:desc"><xsl:apply-templates select="my:desc" /></xsl:if>
       
   250     <xsl:if test="my:option">
       
   251       <ul>
       
   252         <xsl:apply-templates select="my:option" />
       
   253       </ul>
       
   254     </xsl:if>
       
   255     <xsl:apply-templates select="my:defn" />
       
   256   </dd>
       
   257 </xsl:template>
       
   258 
       
   259 <xsl:template match="my:option">
       
   260   <li><xsl:apply-templates select="my:value" />: <xsl:apply-templates select="my:desc" /></li>
       
   261 </xsl:template>
       
   262 
       
   263 <xsl:template match="my:value | my:default">
       
   264   <xsl:choose>
       
   265     <xsl:when test="@type">
       
   266       <span class="{@type}">
       
   267         <xsl:choose>
       
   268           <xsl:when test="@type = 'string'">'<xsl:value-of select="." />'</xsl:when>
       
   269           <xsl:when test="@type = 'rtf'">"<xsl:value-of select="." />"</xsl:when>
       
   270           <xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
       
   271         </xsl:choose>
       
   272       </span>
       
   273     </xsl:when>
       
   274     <xsl:otherwise>
       
   275       <xsl:value-of select="." />
       
   276     </xsl:otherwise>
       
   277   </xsl:choose>
       
   278 </xsl:template>
       
   279 
       
   280 <xsl:template match="my:post">
       
   281 	<div class="post">
       
   282 		<xsl:apply-templates />
       
   283 	</div>
       
   284 </xsl:template>
       
   285 
       
   286 <xsl:template match="my:response">
       
   287 	<div class="response">
       
   288 		<xsl:apply-templates />
       
   289 	</div>
       
   290 </xsl:template>
       
   291 
       
   292 <xsl:template match="my:question">
       
   293 	<div class="question">
       
   294 		<p>
       
   295 			<xsl:call-template name="insert-icon">
       
   296 				<xsl:with-param name="icon" select="'question'" />
       
   297 				<xsl:with-param name="active" select="false()" />
       
   298 			</xsl:call-template>
       
   299 			<xsl:text> </xsl:text>
       
   300 			<xsl:apply-templates select="*[1]/node()" />
       
   301 		</p>
       
   302 		<xsl:apply-templates select="*[position() > 1]"/>
       
   303 	</div>
       
   304 </xsl:template>
       
   305 
       
   306 <xsl:template match="my:example | my:defn">
       
   307 	<pre>
       
   308 		<xsl:apply-templates />
       
   309 	</pre>
       
   310 </xsl:template>
       
   311 
       
   312 <xsl:template match="my:example[parent::my:aside and ancestor::my:example]">
       
   313   <xsl:choose>
       
   314     <xsl:when test="$dynamic = 'true'">
       
   315       <pre>
       
   316         <xsl:apply-templates />
       
   317       </pre>
       
   318     </xsl:when>
       
   319     <xsl:otherwise>
       
   320       <span class="example">
       
   321         <xsl:apply-templates />
       
   322       </span>
       
   323     </xsl:otherwise>
       
   324   </xsl:choose>
       
   325 </xsl:template>
       
   326 
       
   327 <xsl:template match="my:example[parent::my:aside and not(ancestor::my:example)]">
       
   328   <xsl:call-template name="split-and-code">
       
   329     <xsl:with-param name="text" select="string(.)" />
       
   330   </xsl:call-template>
       
   331 </xsl:template>
       
   332 
       
   333 <xsl:template name="split-and-code">
       
   334   <xsl:param name="text" />
       
   335   <br />
       
   336   <xsl:choose>
       
   337     <xsl:when test="contains($text, '&#x0A;')">
       
   338       <code><xsl:value-of select="substring-before($text, '&#x0A;')" /></code>
       
   339       <xsl:call-template name="split-and-code">
       
   340         <xsl:with-param name="text" select="substring-after($text, '&#x0A;')" />
       
   341       </xsl:call-template>
       
   342     </xsl:when>
       
   343     <xsl:otherwise>
       
   344       <code><xsl:value-of select="$text" /></code>
       
   345     </xsl:otherwise>
       
   346   </xsl:choose>
       
   347 </xsl:template>
       
   348 
       
   349 <xsl:template match="my:aside">
       
   350   <xsl:choose>
       
   351     <xsl:when test="$dynamic = 'true'">
       
   352     	<span class="note"
       
   353     	><img src="{$base}resources/icons/note.gif" height="17" width="13" border="0"
       
   354     		    style="z-index: 2;"
       
   355     		    onmouseover="javascript:{generate-id()}.style.visibility='visible';"
       
   356     	      onmouseout="javascript:{generate-id()}.style.visibility='hidden';"
       
   357     	/><span class="popup" id="{generate-id()}"
       
   358     		      onmouseover="javascript:{generate-id()}.style.visibility='visible';"
       
   359     	        onmouseout="javascript:{generate-id()}.style.visibility='hidden';">
       
   360     			<xsl:apply-templates />
       
   361     		</span
       
   362     	></span>
       
   363     </xsl:when>
       
   364     <xsl:otherwise>
       
   365       <xsl:text> </xsl:text>
       
   366       <span class="note">[<xsl:apply-templates />]</span>
       
   367       <xsl:text> </xsl:text>
       
   368     </xsl:otherwise>
       
   369   </xsl:choose>
       
   370 </xsl:template>
       
   371 
       
   372 <xsl:template match="my:quote">
       
   373   <blockquote uri="{@href}">
       
   374     <xsl:apply-templates />
       
   375   </blockquote>
       
   376   <p class="byline">
       
   377     <xsl:text>[From </xsl:text>
       
   378     <xsl:call-template name="link">
       
   379       <xsl:with-param name="link" select="@href" />
       
   380       <xsl:with-param name="value">
       
   381         <xsl:value-of select="@href" />
       
   382       </xsl:with-param>
       
   383     </xsl:call-template>
       
   384     <xsl:text>]</xsl:text>
       
   385   </p>
       
   386 </xsl:template>
       
   387 
       
   388 <xsl:template match="my:icon">
       
   389 	<xsl:call-template name="insert-icon">
       
   390 		<xsl:with-param name="icon" select="@name" />
       
   391 	</xsl:call-template>
       
   392 </xsl:template>
       
   393 
       
   394 <xsl:template name="insert-icon">
       
   395 	<xsl:param name="icon" select="'goto'" />
       
   396 	<xsl:param name="active" select="true()" />
       
   397 	<img src="{$base}resources/icons/{$icon}.gif" height="28" width="28" border="0">
       
   398 		<xsl:attribute name="src">
       
   399 			<xsl:value-of select="$base" />
       
   400 			<xsl:text>resources/icons/</xsl:text>
       
   401 			<xsl:if test="not($active)">click-</xsl:if>
       
   402 			<xsl:value-of select="$icon" />
       
   403 			<xsl:text>.gif</xsl:text>
       
   404 		</xsl:attribute>
       
   405 		<xsl:if test="$active">
       
   406 			<xsl:attribute name="onmouseover">javascript:this.src='<xsl:value-of select="$base" />resources/icons/over-<xsl:value-of select="$icon" />.gif'</xsl:attribute>
       
   407 			<xsl:attribute name="onclick">javascript:this.src='<xsl:value-of select="$base" />resources/icons/click-<xsl:value-of select="$icon" />.gif'</xsl:attribute>
       
   408 			<xsl:attribute name="onmouseout">javascript:this.src='<xsl:value-of select="$base" />resources/icons/<xsl:value-of select="$icon" />.gif'</xsl:attribute>
       
   409 		</xsl:if>
       
   410 	</img>
       
   411 </xsl:template>
       
   412 
       
   413 <xsl:template match="my:links">
       
   414 	<xsl:choose>
       
   415 		<xsl:when test="parent::html:dd">
       
   416 			<xsl:apply-templates select="my:link" mode="list" />			
       
   417 		</xsl:when>
       
   418 		<xsl:otherwise>
       
   419 			<xsl:call-template name="columnise">
       
   420 				<xsl:with-param name="max-height" select="3" />
       
   421 			</xsl:call-template>
       
   422 		</xsl:otherwise>
       
   423 	</xsl:choose>
       
   424 </xsl:template>
       
   425 
       
   426 <xsl:template name="columnise">
       
   427 	<xsl:param name="max-height" select="5" />
       
   428 	<xsl:param name="max-width" select="3" />
       
   429 	<xsl:variable name="no-items" select="count(*)" />
       
   430 	<xsl:variable name="width">
       
   431 		<xsl:choose>
       
   432 			<xsl:when test="$no-items > $max-height * $max-width">
       
   433 				<xsl:value-of select="$max-width" />
       
   434 			</xsl:when>
       
   435 			<xsl:otherwise>
       
   436 				<xsl:value-of select="ceiling($no-items div $max-height)" />
       
   437 			</xsl:otherwise>
       
   438 		</xsl:choose>
       
   439 	</xsl:variable>
       
   440 	<xsl:variable name="height" select="ceiling($no-items div $width)" />
       
   441 	<table>
       
   442 		<colgroup span="{$width}" />
       
   443 		<tr>
       
   444 			<xsl:for-each select="*[position() = 1 or position() mod $height = 1]">
       
   445 				<td>
       
   446 					<xsl:apply-templates select=". | following-sibling::*[position() &lt; $height]" mode="list" />
       
   447 				</td>
       
   448 			</xsl:for-each>
       
   449 		</tr>
       
   450 	</table>
       
   451 </xsl:template>
       
   452 
       
   453 <xsl:template match="my:link" mode="list">
       
   454 	<p class="link">
       
   455 		<xsl:call-template name="link">
       
   456 			<xsl:with-param name="link" select="@href" />
       
   457 			<xsl:with-param name="value">
       
   458 				<xsl:value-of select="." />
       
   459 			</xsl:with-param>
       
   460 			<xsl:with-param name="addicon" select="true()" />
       
   461 		</xsl:call-template>
       
   462 	</p>
       
   463 </xsl:template>
       
   464 
       
   465 <xsl:template match="my:link">
       
   466 	<xsl:apply-templates select="." mode="link" />
       
   467 </xsl:template>
       
   468 
       
   469 <xsl:template match="*[@href][. != '']" mode="link">
       
   470 	<xsl:call-template name="link">
       
   471 		<xsl:with-param name="link" select="@href" />
       
   472 		<xsl:with-param name="value">
       
   473 			<xsl:apply-templates />
       
   474 		</xsl:with-param>
       
   475 		<xsl:with-param name="addicon" select="@addicon" />
       
   476 	</xsl:call-template>
       
   477 </xsl:template>
       
   478 
       
   479 <xsl:template match="*[@href][. = '']" mode="link">
       
   480 	<xsl:call-template name="link">
       
   481 		<xsl:with-param name="link" select="@href" />
       
   482 		<xsl:with-param name="value">
       
   483 			<xsl:value-of select="@href" />
       
   484 		</xsl:with-param>
       
   485 		<xsl:with-param name="addicon" select="@addicon" />
       
   486 	</xsl:call-template>
       
   487 </xsl:template>
       
   488 
       
   489 <xsl:template match="text()|@*" mode="link">
       
   490 	<xsl:call-template name="link">
       
   491 		<xsl:with-param name="link" select="." />
       
   492 		<xsl:with-param name="value">
       
   493 			<xsl:value-of select="." />
       
   494 		</xsl:with-param>
       
   495 	</xsl:call-template>
       
   496 </xsl:template>
       
   497 
       
   498 <xsl:template name="link">
       
   499 	<xsl:param name="link" />
       
   500 	<xsl:param name="value" />
       
   501 	<xsl:param name="addicon" select="''" />
       
   502 	<xsl:variable name="uri">
       
   503 		<xsl:call-template name="full-uri">
       
   504 			<xsl:with-param name="uri" select="$link" />
       
   505 		</xsl:call-template>
       
   506 	</xsl:variable>
       
   507 	<xsl:variable name="class">
       
   508 		<xsl:call-template name="uri-class">
       
   509 			<xsl:with-param name="uri" select="$uri" />
       
   510 		</xsl:call-template>
       
   511 	</xsl:variable>
       
   512 	<xsl:if test="$addicon">
       
   513 		<a href="{$uri}">
       
   514 			<xsl:attribute name="class">
       
   515 				<xsl:text>img </xsl:text>
       
   516 				<xsl:value-of select="$class" />
       
   517 			</xsl:attribute>
       
   518 			<xsl:call-template name="insert-icon">
       
   519 				<xsl:with-param name="icon">
       
   520 					<xsl:call-template name="icon-type">
       
   521 						<xsl:with-param name="uri" select="$uri" />
       
   522 					</xsl:call-template>
       
   523 				</xsl:with-param>
       
   524 			</xsl:call-template>
       
   525 		</a>
       
   526 		<xsl:text> </xsl:text>
       
   527 	</xsl:if>
       
   528 	<a href="{$uri}">
       
   529 		<xsl:if test="$class != ''">
       
   530 			<xsl:attribute name="class">
       
   531 				<xsl:value-of select="$class" />
       
   532 			</xsl:attribute>
       
   533 		</xsl:if>
       
   534 		<xsl:copy-of select="$value" />
       
   535 	</a>
       
   536 </xsl:template>
       
   537 
       
   538 <xsl:template name="full-uri">
       
   539 	<xsl:param name="uri" />
       
   540 	<xsl:variable name="partial-uri">
       
   541 		<xsl:choose>
       
   542 			<xsl:when test="$dynamic='false' and
       
   543 			                substring($uri, string-length($uri) - 3, 4) = '.xml'">
       
   544 				<xsl:value-of select="concat(substring($uri, 1, string-length($uri) - 4), '.html')" />
       
   545 			</xsl:when>
       
   546 			<xsl:otherwise><xsl:value-of select="$uri" /></xsl:otherwise>
       
   547 		</xsl:choose>
       
   548 	</xsl:variable>
       
   549 	<xsl:choose>
       
   550 		<xsl:when test="starts-with($partial-uri, 'www')">
       
   551 			<xsl:text>http://</xsl:text><xsl:value-of select="$partial-uri" />
       
   552 		</xsl:when>
       
   553 		<xsl:when test="contains($partial-uri, '@') and not(starts-with($partial-uri, 'mailto:'))">
       
   554 			<xsl:text>mailto:</xsl:text><xsl:value-of select="$partial-uri" />
       
   555 		</xsl:when>
       
   556 		<xsl:otherwise><xsl:value-of select="$partial-uri" /></xsl:otherwise>
       
   557 	</xsl:choose>
       
   558 </xsl:template>
       
   559 
       
   560 <xsl:template name="uri-class">
       
   561 	<xsl:param name="uri" />
       
   562 	<xsl:choose>
       
   563 		<xsl:when test="starts-with($uri, 'http://') and not(starts-with($uri, $base))">offsite</xsl:when>
       
   564 		<xsl:when test="starts-with($uri, 'mailto:')">mailto</xsl:when>
       
   565 		<xsl:when test="starts-with($uri, '#')">local</xsl:when>
       
   566 	</xsl:choose>
       
   567 </xsl:template>
       
   568 
       
   569 <xsl:template name="icon-type">
       
   570 	<xsl:param name="uri" />
       
   571 	<xsl:variable name="url">
       
   572 	  <xsl:choose>
       
   573 	    <xsl:when test="starts-with($uri, 'http://')"><xsl:value-of select="substring-after($uri, 'http://')" /></xsl:when>
       
   574 	    <xsl:otherwise><xsl:value-of select="$uri" /></xsl:otherwise>
       
   575 	  </xsl:choose>
       
   576 	</xsl:variable>
       
   577 	<xsl:choose>
       
   578 		<xsl:when test="(not(contains($url, '/')) and starts-with($url, 'www.')) or (contains($url, '/') and not(substring-after($url, '/')))">home</xsl:when>
       
   579 		<xsl:when test="contains($url, '@')">mail</xsl:when>
       
   580 		<xsl:otherwise>goto</xsl:otherwise>
       
   581 	</xsl:choose>
       
   582 </xsl:template>
       
   583 
       
   584 <xsl:template match="/*" mode="colophon">
       
   585   <xsl:variable name="metadata" select="/*/rdf:RDF" />
       
   586   <xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
       
   587 	<div id="colophon">
       
   588 		<hr class="final" />
       
   589 		<p>
       
   590 			<xsl:apply-templates select="$uri" mode="link" />
       
   591 			<xsl:variable name="modified">
       
   592 				<xsl:call-template name="get-metadata">
       
   593 					<xsl:with-param name="what" select="'date::modified'" />
       
   594 				</xsl:call-template>
       
   595 			</xsl:variable>
       
   596 			<xsl:if test="string($modified)">
       
   597 				<xsl:text> last modified </xsl:text>
       
   598 				<xsl:copy-of select="$modified" />
       
   599 			</xsl:if>
       
   600 			<xsl:variable name="creator">
       
   601 				<xsl:call-template name="get-metadata">
       
   602 					<xsl:with-param name="what" select="'creator::vCard::mailto-link'" />
       
   603 				</xsl:call-template>
       
   604 			</xsl:variable>
       
   605 			<xsl:text> by </xsl:text>
       
   606 			<xsl:choose>
       
   607   			<xsl:when test="string($creator)">
       
   608   				<xsl:copy-of select="$creator" />
       
   609   			</xsl:when>
       
   610   			<xsl:otherwise>
       
   611   			  <a href="mailto:mail@jenitennison.com" class="mailto">Jeni Tennison</a>
       
   612   			</xsl:otherwise>
       
   613   		</xsl:choose>		  
       
   614 		</p>
       
   615 	</div>
       
   616 </xsl:template>
       
   617 
       
   618 </xsl:stylesheet>