xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/xsltc/mk/mk055.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0" encoding="ISO-8859-1" ?>
2<xsl:stylesheet
3        version="1.0"
4	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
6  <!-- Test FileName: mk055.xsl -->
7  <!-- Source Document: XSLT Programmer's Reference by Michael Kay -->
8  <!-- Example: REC-xpath-19991116.xml, spec.dtd, xpath.xsl -->
9  <!-- Chapter/Page: 9-588 -->
10  <!-- Purpose: Formatting the XPath Specification -->
11
12<xsl:import href="mk054.xsl"/>
13<xsl:template match="proto">
14<p><a name="function-{@name}">
15<b>Function: </b>
16<i><xsl:value-of select="@return-type"/></i>
17<xsl:text> </xsl:text>
18<b><xsl:value-of select="@name"/></b>
19<xsl:text>(</xsl:text>
20<xsl:for-each select="arg">
21<xsl:if test="not(position()=1)">
22<xsl:text>, </xsl:text>
23</xsl:if>
24<i><xsl:value-of select="@type"/></i>
25<xsl:choose>
26<xsl:when test="@occur='rep'">*</xsl:when>
27<xsl:when test="@occur='opt'">?</xsl:when>
28</xsl:choose>
29</xsl:for-each>
30<xsl:text>)</xsl:text>
31</a></p>
32</xsl:template>
33<xsl:template match="function">
34<b><a href="#function-{.}"><xsl:apply-templates/></a></b>
35</xsl:template>
36<xsl:template match="xfunction">
37<b><a href="{@href}#function-{.}"><xsl:apply-templates/></a></b>
38</xsl:template>
39
40<!-- Support for <loc role="available-format">...</loc> -->
41<xsl:template match="publoc/loc[@role='available-format']">
42  <xsl:if test="not(preceding-sibling::loc[@role='available-format'])">
43    <xsl:text>(available in </xsl:text>
44  </xsl:if>
45  <a href="{@href}"><xsl:apply-templates/></a>
46  <xsl:variable name="nf"
47    select="count(following-sibling::loc[@role='available-format'])"/>
48  <xsl:choose>
49   <xsl:when test="not($nf)">
50     <xsl:text>)</xsl:text>
51   </xsl:when>
52   <xsl:when test="$nf = 1">
53     <xsl:choose>
54       <xsl:when test="count(../loc[@role='available-format'])=2">
55	 <xsl:text> or </xsl:text>
56       </xsl:when>
57       <xsl:otherwise>
58	 <xsl:text>, or </xsl:text>
59       </xsl:otherwise>
60     </xsl:choose>
61   </xsl:when>
62   <xsl:otherwise>
63     <xsl:text>, </xsl:text>
64   </xsl:otherwise>
65  </xsl:choose>
66</xsl:template>
67
68
69  <!--
70   * Licensed to the Apache Software Foundation (ASF) under one
71   * or more contributor license agreements. See the NOTICE file
72   * distributed with this work for additional information
73   * regarding copyright ownership. The ASF licenses this file
74   * to you under the Apache License, Version 2.0 (the  "License");
75   * you may not use this file except in compliance with the License.
76   * You may obtain a copy of the License at
77   *
78   *     http://www.apache.org/licenses/LICENSE-2.0
79   *
80   * Unless required by applicable law or agreed to in writing, software
81   * distributed under the License is distributed on an "AS IS" BASIS,
82   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83   * See the License for the specific language governing permissions and
84   * limitations under the License.
85  -->
86
87</xsl:stylesheet>
88