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