]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/substKey.xsl
ocaml 3.09 transition
[helm.git] / helm / on-line / xslt / substKey.xsl
1 <?xml version="1.0"?>
2
3 <xsl:stylesheet version="1.0"
4      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5      xmlns:uwobo="http://helm.cs.unibo.it/uwobo"
6      xmlns:subst="http://www.cs.unibo.it/helm/subst"
7 >
8
9 <xsl:output
10        method="html"
11        encoding="ISO-8859-1"
12        media-type="text/html" />
13 <!--
14 <xsl:output
15         method="xml"
16         encoding="iso-8859-1"
17         media-type="text/xml"
18         doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
19         doctype-system="DTD/xhtml1-transitional.dtd" />
20 -->
21
22 <xsl:param name="processorURL" select="''"/>
23 <xsl:param name="profile" select="''"/>
24
25 <xsl:variable name="params" select="document(concat($processorURL, 'getparams?id=', $profile))"/>
26 <xsl:variable name="profiles" select="document(concat($processorURL, 'listprofiles'))//li"/>
27
28 <xsl:template match="node()">
29   <xsl:copy>
30     <xsl:copy-of select="@*"/>
31     <xsl:apply-templates />
32   </xsl:copy>
33 </xsl:template>
34
35 <xsl:template match="uwobo:key">
36   <xsl:variable name="name" select="@name"/>
37   <xsl:value-of select="string($params/html/body/ul/li[string(key)=$name]/value)"/>
38 </xsl:template>
39
40 <xsl:template match="uwobo:profile">
41   <xsl:value-of select="$profile"/>
42 </xsl:template>
43
44 <xsl:template match="uwobo:profileOptionList">
45   <xsl:apply-templates select="$profiles" mode="make_form_option"/>
46 </xsl:template>
47
48 <xsl:template match="uwobo:profileCtrlOptionList">
49   <script>
50     var cicurls = new Array();
51   </script>
52   <select onChange="window.open(cicurls[selectedIndex],'_top')">
53     <xsl:apply-templates select="$profiles" mode="make_ctrl_form_option">
54      <xsl:with-param name="type" select="@type"/>
55     </xsl:apply-templates>
56   </select>
57 </xsl:template>
58
59 <xsl:template match="li" mode="make_form_option">
60   <xsl:variable name="tmp" select="string(.)" />
61   <option value="{$tmp}">
62     <xsl:if test="$tmp=$profile">
63       <xsl:attribute name="selected">1</xsl:attribute>
64     </xsl:if>
65     <xsl:value-of select="$tmp"/>
66   </option>
67 </xsl:template>
68
69 <xsl:template match="li" mode="make_ctrl_form_option">
70   <xsl:param name="type" select="''"/>
71   <script>
72     <xsl:text>cicurls[</xsl:text>
73     <xsl:value-of select="position()-1" />
74     <xsl:text>] = "</xsl:text>
75     <xsl:choose>
76      <xsl:when test="$type = 'cic'">
77       <subst:makeHTMLURLwithProfile profile="{string(.)}"/>
78      </xsl:when>
79      <xsl:otherwise>
80       <subst:makeTheoryURLwithProfile profile="{string(.)}"/>
81      </xsl:otherwise>
82     </xsl:choose>
83     <xsl:text>";</xsl:text>
84   </script><xsl:text>
85   </xsl:text>
86   <option value="{position()}">
87     <xsl:if test="string(.)=$profile">
88       <xsl:attribute name="selected">1</xsl:attribute>
89     </xsl:if>
90     <xsl:value-of select="string(.)"/>
91   </option>
92 </xsl:template>
93
94 </xsl:stylesheet>