source: DASISH/t5.6/client/branches/webannotator-basic-current-xsd/chrome/markingcollection/content/markingcollection/treelistview.xsl @ 5703

Last change on this file since 5703 was 5703, checked in by stephanie.roth@snd.gu.se, 10 years ago

Initial commit of current status quo from GitHub. TODO: Adjust client code to work with updated xsd file.

  • Property svn:executable set to *
File size: 11.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2<xsl:stylesheet id="treelist" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes" />
4  <xsl:template match="/">
5    <xsl:apply-templates/>
6  </xsl:template>
7  <xsl:template match="LIST">
8    <html>
9      <head>
10        <meta name="fid"><xsl:attribute name="content"><xsl:value-of select="@fid"/></xsl:attribute></meta>
11        <meta name="dbtype"><xsl:attribute name="content"><xsl:value-of select="@dbtype"/></xsl:attribute></meta>
12        <meta name="xslpath"><xsl:attribute name="content"><xsl:value-of select="@xslpath"/></xsl:attribute></meta>
13        <meta name="_fileid"><xsl:attribute name="content"><xsl:value-of select="@_fileid"/></xsl:attribute></meta>
14        <title><xsl:value-of select="@title" /></title>
15        <script type="text/javascript">
16        <![CDATA[
17          function twisty(elem){
18            var cur_twisty = (elem.src.indexOf("fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII")>=0)?true:false;
19            var childid = elem.getAttribute("childid").split(",");
20            for(var i=0;i<childid.length;i++){
21              var child_elem = document.getElementById(childid[i]);
22              if(!child_elem) continue;
23              child_elem.style.display = cur_twisty?'none':'';
24            }
25            elem.src = cur_twisty ?
26              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAChSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAMcGU//z5E4wZGRnhbBgACCAWGOPbt28M6Gx2dnYwDRBAYEX//v1jEBISgiuCsf/+/QumAQIIrOjr168MV69eBQtoa2vD2SBxEAAIIBaY8V++fIGbBGPDrAUIILCiHz9+MIiLi4MFHjx4AFcMEgcBgAACKZpdW/MITzAxzAYIMADnOV3STeCBBwAAAABJRU5ErkJggg==" :
27              "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=";
28          }
29          function load(aEvent){
30            var regexp_png = new RegExp("^data:image/\\w+;base64,");
31            var nodeWalker = document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false);
32            for(var txtNode=nodeWalker.nextNode();txtNode;txtNode = nodeWalker.nextNode()){
33              if(txtNode.parentNode.nodeName == "TEXTAREA") continue;
34              try{
35                if(txtNode.nodeValue.match(/^(data:image\/\w+;base64,).*/img)){ txtNode.nodeValue = RegExp.$1; }
36              }catch(e){
37                if(regexp_png.test(txtNode.nodeValue)){ txtNode.nodeValue = "data:image/png;base64,"; }
38              }
39              txtNode.nodeValue = txtNode.nodeValue.replace(/([\/&\?])([^\/&\?])/mg,"$1 $2");
40            }
41          }
42        ]]>
43        </script>
44      </head>
45      <body style="margin: 1em;" onload="load(event)">
46        <xsl:apply-templates/>
47      </body>
48    </html>
49  </xsl:template>
50
51  <xsl:template match="FOLDER">
52    <xsl:choose>
53      <xsl:when test="position() = 2">
54        <div style="margin-left: 0.25em;">
55          <xsl:attribute name="id">
56            <xsl:value-of select="ID" />
57          </xsl:attribute>
58          <table style="padding:0px;border:1px solid #fc6;" width="100%">
59            <tr><td style="background-color: #fc6;font-weight: bold;">
60              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
61                <xsl:attribute name="childid">
62                  <xsl:value-of select="CHILDID" />
63                </xsl:attribute>
64              </img>
65              <xsl:value-of select="FID_TITLE" />
66            </td></tr>
67            <tr><td>
68              <xsl:apply-templates />
69            </td></tr>
70          </table>
71        </div>
72      </xsl:when>
73      <xsl:otherwise>
74        <div style="margin-left: 1em;">
75          <xsl:attribute name="id">
76            <xsl:value-of select="ID" />
77          </xsl:attribute>
78
79          <table style="padding:0px;border-left:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
80            <tr><td style="background-color: #fc6;font-weight: bold;">
81              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
82                <xsl:attribute name="childid">
83                  <xsl:value-of select="CHILDID" />
84                </xsl:attribute>
85              </img>
86              <xsl:value-of select="FID_TITLE" />
87            </td></tr>
88            <tr><td>
89              <xsl:apply-templates />
90            </td></tr>
91          </table>
92        </div>
93      </xsl:otherwise>
94    </xsl:choose>
95  </xsl:template>
96
97  <xsl:template match="FOLDER/FID_TITLE" />
98  <xsl:template match="FOLDER/FID_NOTE" />
99  <xsl:template match="FOLDER/FID_STYLE" />
100  <xsl:template match="FOLDER/ID" />
101  <xsl:template match="FOLDER/CHILDID" />
102
103
104
105  <xsl:template match="OBJECT">
106    <div style="margin-left: 1em;">
107      <xsl:attribute name="id">
108        <xsl:value-of select="ID" />
109      </xsl:attribute>
110      <table style="padding:0px;border-left:1px solid #fc6;border-top:1px solid #fc6;" width="100%">
111        <thead>
112          <tr>
113            <td colspan="3" style="background-color: #ffc;font-weight: bold;">
114              <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACNSURBVHjaYoyNOZTKwMCQzoAbzAQIIAagojP/8QCQPEAAscCU//z5E8MIdnZ2MA0QQHBF3759w6kIIIDAiv79+8cgJCSEoejv379gGiCAwIq+fv3KcPXqVQxFIHEQAAggFphVX758wVAEcwJAAIEV/fjxg0FcXBxDEUgcBAACCKRodm3NIzzBxDAbIMAAYadJkYnDnfwAAAAASUVORK5CYII=" valign="center" style="margin-right: 4px;" onclick="twisty(this)">
115                <xsl:attribute name="childid"><xsl:value-of select="ID" />child</xsl:attribute>
116              </img>
117              <label edit="true" dbcolumn="title">
118                <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
119                <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
120                <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
121                <xsl:value-of select="OID_TITLE" />
122              </label>
123            </td>
124          </tr>
125        </thead>
126        <tbody>
127          <xsl:attribute name="id"><xsl:value-of select="ID" />child</xsl:attribute>
128          <tr>
129            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;">Note</th>
130             <xsl:choose>
131               <xsl:when test="OID_IMG!=''">
132                  <td width="" style="font-family:serif;">
133                    <label edit="true" dbcolumn="note">
134                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
135                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
136                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
137                      <xsl:value-of select="OID_NOTE" />
138                    </label>
139                  </td>
140                  <td rowspan="4" align="right" valign="top">
141                    <img edit="true" style="border-left:1px solid #ff9;">
142                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
143                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
144                      <xsl:attribute name="src"><xsl:value-of select="OID_IMG" /></xsl:attribute>
145                      <xsl:attribute name="width"><xsl:value-of select="OID_IMG_DISP_WIDTH" /></xsl:attribute>
146                      <xsl:attribute name="height"><xsl:value-of select="OID_IMG_DISP_HEIGHT" /></xsl:attribute>
147                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
148                    </img>
149                  </td>
150               </xsl:when>
151               <xsl:when test="OID_STRUCTURE!=''">
152                  <td width="" style="font-family:serif;">
153                    <label edit="true" dbcolumn="note">
154                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
155                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
156                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
157                      <xsl:value-of select="OID_NOTE" />
158                    </label>
159                  </td>
160                  <td rowspan="4" align="" valign="top" style="border-left:1px solid #ff9;">
161                    <xsl:copy-of select="OID_STRUCTURE" />
162                  </td>
163               </xsl:when>
164               <xsl:otherwise>
165                  <td width="400" style="font-family:serif;">
166                    <label edit="true" dbcolumn="note">
167                      <xsl:attribute name="oid"><xsl:value-of select="OID" /></xsl:attribute>
168                      <xsl:attribute name="dbtype"><xsl:value-of select="DBTYPE" /></xsl:attribute>
169                      <xsl:attribute name="pfid"><xsl:value-of select="PFID" /></xsl:attribute>
170                      <xsl:value-of select="OID_NOTE" />
171                    </label>
172                  </td>
173               </xsl:otherwise>
174             </xsl:choose>
175          </tr>
176          <tr>
177            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;">URL</th>
178            <td >
179              <a>
180                <xsl:attribute name="href">
181                  <xsl:value-of select="DOC_URL" />
182                </xsl:attribute>
183                <xsl:value-of select="DOC_URL" />
184              </a>
185            </td>
186          </tr>
187          <tr>
188            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;white-space:nowrap;">
189              <a href="http://www.hyper-anchor.org/" target="_hyperanchor" title="HYPER-ANCHOR Homepage">HYPER-ANCHOR</a>
190            </th>
191            <td  style="">
192              <textarea rows="1" wrap="soft" readonly="true" style="width:100%;-moz-appearance: none !important;border: none;background:white  !important;" onfocus="this.select();"><xsl:value-of select="HYPER_ANCHOR"/></textarea>
193            </td>
194          </tr>
195          <tr>
196            <th width="10" style="background-color: #e6e6e6;font-size:0.9em;">Contents</th>
197            <td  style="">
198              <xsl:value-of select="OID_TXT" />
199            </td>
200          </tr>
201
202        </tbody>
203      </table>
204    </div>
205  </xsl:template>
206
207</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.