]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/on-line/xslt/substKey.xsl
New HELM interface almost stable.
[helm.git] / helm / on-line / xslt / substKey.xsl
diff --git a/helm/on-line/xslt/substKey.xsl b/helm/on-line/xslt/substKey.xsl
new file mode 100644 (file)
index 0000000..a5acc09
--- /dev/null
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+     xmlns:uwobo="http://helm.cs.unibo.it/uwobo"
+     xmlns:subst="http://www.cs.unibo.it/helm/subst"
+>
+
+<xsl:output
+       method="html"
+       encoding="ISO-8859-1"
+       media-type="text/html" />
+<!--
+<xsl:output
+        method="xml"
+        encoding="iso-8859-1"
+        media-type="text/xml"
+        doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="DTD/xhtml1-transitional.dtd" />
+-->
+
+<xsl:param name="processorURL" select="''"/>
+<xsl:param name="profile" select="''"/>
+
+<xsl:variable name="params" select="document(concat($processorURL, 'getparams?id=', $profile))"/>
+<xsl:variable name="profiles" select="document(concat($processorURL, 'listprofiles'))//li"/>
+
+<xsl:template match="node()">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates />
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="uwobo:key">
+  <xsl:variable name="name" select="@name"/>
+  <xsl:value-of select="string($params/html/body/ul/li[string(key)=$name]/value)"/>
+</xsl:template>
+
+<xsl:template match="uwobo:profile">
+  <xsl:value-of select="$profile"/>
+</xsl:template>
+
+<xsl:template match="uwobo:profileOptionList">
+  <xsl:apply-templates select="$profiles" mode="make_form_option"/>
+</xsl:template>
+
+<xsl:template match="uwobo:profileCtrlOptionList">
+  <script>
+    var cicurls = new Array();
+  </script>
+  <select onChange="window.open(cicurls[selectedIndex],'_top')">
+    <xsl:apply-templates select="$profiles" mode="make_ctrl_form_option">
+     <xsl:with-param name="type" select="@type"/>
+    </xsl:apply-templates>
+  </select>
+</xsl:template>
+
+<xsl:template match="li" mode="make_form_option">
+  <xsl:variable name="tmp" select="string(.)" />
+  <option value="{$tmp}">
+    <xsl:if test="$tmp=$profile">
+      <xsl:attribute name="selected">1</xsl:attribute>
+    </xsl:if>
+    <xsl:value-of select="$tmp"/>
+  </option>
+</xsl:template>
+
+<xsl:template match="li" mode="make_ctrl_form_option">
+  <xsl:param name="type" select="''"/>
+  <script>
+    <xsl:text>cicurls[</xsl:text>
+    <xsl:value-of select="position()-1" />
+    <xsl:text>] = "</xsl:text>
+    <xsl:choose>
+     <xsl:when test="$type = 'cic'">
+      <subst:makeHTMLURLwithProfile profile="{string(.)}"/>
+     </xsl:when>
+     <xsl:otherwise>
+      <subst:makeTheoryURLwithProfile profile="{string(.)}"/>
+     </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>";</xsl:text>
+  </script><xsl:text>
+  </xsl:text>
+  <option value="{position()}">
+    <xsl:if test="string(.)=$profile">
+      <xsl:attribute name="selected">1</xsl:attribute>
+    </xsl:if>
+    <xsl:value-of select="string(.)"/>
+  </option>
+</xsl:template>
+
+</xsl:stylesheet>