212
|
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
|
2
|
|
3 <xsl:output method="xml" indent="yes" encoding="iso-8859-1"
|
|
4 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
|
|
5 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
|
|
6
|
|
7 <!-- the start -->
|
|
8 <xsl:template match="relato">
|
|
9 <html xmlns="http://www.w3.org/1999/xhtml">
|
|
10 <head>
|
223
|
11 <script type="text/javascript" src="relato/relato.js">
|
|
12 // this comment has to be here, otherwise xerces translates this
|
|
13 // empty tag to a self-closing one, which is bad for HTML that
|
|
14 // needs a closing script-tag
|
|
15 </script>
|
212
|
16 <script type="text/javascript">
|
|
17 <xsl:apply-templates select="functions" />
|
|
18 <xsl:apply-templates select="buttons" />
|
223
|
19 <xsl:apply-templates select="protected" />
|
|
20 <xsl:apply-templates select="default" />
|
212
|
21 </script>
|
|
22 </head>
|
|
23 <xsl:apply-templates select="frames" />
|
|
24 </html>
|
|
25 </xsl:template>
|
|
26
|
|
27 <xsl:template match="frames">
|
|
28 <xsl:copy-of select="frameset" />
|
|
29 </xsl:template>
|
|
30
|
|
31 <xsl:template match="functions">
|
|
32 <xsl:for-each select="function">
|
|
33 function <xsl:value-of select="@name" />() {
|
|
34 if (frameSelected()) {
|
|
35 <xsl:for-each select="validInFrame">
|
|
36 if (nameOfSelectedFrame() == "<xsl:value-of select="@name" />") {
|
|
37 id = selectedFrameObject();
|
223
|
38 if (typeof(id.<xsl:value-of select="../@name" />) == 'function') {
|
|
39 return id.<xsl:value-of select="../@name" />(<xsl:value-of select="../@name" />.arguments[0], <xsl:value-of select="../@name" />.arguments[1], <xsl:value-of select="../@name" />.arguments[2], <xsl:value-of select="../@name" />.arguments[3]);
|
|
40 }
|
212
|
41 }
|
|
42 </xsl:for-each>
|
|
43 } else {
|
|
44 <xsl:choose>
|
|
45 <xsl:when test="not(@quiet = 'true')">
|
|
46 // alert message
|
|
47 noFrameSelected();
|
|
48 </xsl:when>
|
|
49 <xsl:otherwise>
|
|
50 // be quiet
|
|
51 return false;
|
|
52 </xsl:otherwise>
|
|
53 </xsl:choose>
|
|
54 }
|
|
55 }
|
|
56 </xsl:for-each>
|
|
57 </xsl:template>
|
|
58
|
|
59 <xsl:template match="buttons">
|
|
60 function dynamicButtons() {
|
|
61 var btns = '';
|
|
62 <xsl:for-each select="button">
|
|
63 btns += '#<xsl:value-of select="@name" />|<xsl:value-of select="@command" />';</xsl:for-each>
|
|
64 return btns.slice(1);
|
|
65 }
|
|
66 </xsl:template>
|
|
67
|
223
|
68 <xsl:template match="protected">
|
|
69 function protectedFrames() {
|
|
70 var frames = new Array ();
|
|
71 <xsl:for-each select="frame">
|
|
72 frames.push('<xsl:value-of select="@name" />');</xsl:for-each>
|
|
73 return frames;
|
|
74 }
|
|
75 </xsl:template>
|
|
76
|
|
77 <xsl:template match="default">
|
|
78 top.focused.name = '<xsl:value-of select="frame/@name" />';
|
|
79 </xsl:template>
|
|
80
|
212
|
81 </xsl:stylesheet>
|