annotate toolboxes/graph_visualisation/share/graphviz/doc/html/schema/attributes.xslt @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 <?xml version="1.0"?>
wolffd@0 2 <xsl:stylesheet
wolffd@0 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
wolffd@0 4 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
wolffd@0 5 xmlns="http://www.w3.org/1999/xhtml"
wolffd@0 6 xmlns:gv="urn:graphviz"
wolffd@0 7 version="1.0">
wolffd@0 8
wolffd@0 9 <xsl:output method="html" />
wolffd@0 10
wolffd@0 11 <xsl:variable name="arguments" select="document('arguments.xml')" />
wolffd@0 12
wolffd@0 13 <xsl:template match="/">
wolffd@0 14 <html>
wolffd@0 15 <head>
wolffd@0 16 <title>Node, Edge and Graph Attributes</title>
wolffd@0 17 <style>
wolffd@0 18 body
wolffd@0 19 {
wolffd@0 20 margin: 0px;
wolffd@0 21 padding: 0px;
wolffd@0 22 overflow: hidden;
wolffd@0 23
wolffd@0 24 font-family: Georgia;
wolffd@0 25 }
wolffd@0 26
wolffd@0 27 code
wolffd@0 28 {
wolffd@0 29 font-family: Courier;
wolffd@0 30 }
wolffd@0 31
wolffd@0 32 a
wolffd@0 33 {
wolffd@0 34 text-decoration: none;
wolffd@0 35 }
wolffd@0 36
wolffd@0 37 a:hover
wolffd@0 38 {
wolffd@0 39 text-decoration: underline;
wolffd@0 40 }
wolffd@0 41
wolffd@0 42 #indices
wolffd@0 43 {
wolffd@0 44 position: absolute;
wolffd@0 45 left: 0px;
wolffd@0 46 width: 200px;
wolffd@0 47 top: 0px;
wolffd@0 48 bottom: 0px; /* IE doesn't use this */
wolffd@0 49 height: expression(offsetParent.offsetHeight); /* only IE uses this */
wolffd@0 50 overflow: auto;
wolffd@0 51
wolffd@0 52 background: #EEEEEE
wolffd@0 53 }
wolffd@0 54
wolffd@0 55 #contents
wolffd@0 56 {
wolffd@0 57 position: absolute;
wolffd@0 58 left: 210px;
wolffd@0 59 right:0px; /* IE doesn't use this */
wolffd@0 60 width: expression(offsetParent.offsetWidth-210); /* only IE uses this */
wolffd@0 61 top: 0px;
wolffd@0 62 bottom: 0px; /* IE doesn't use this */
wolffd@0 63 height: expression(offsetParent.offsetHeight); /* only IE uses this */
wolffd@0 64 overflow: auto;
wolffd@0 65 }
wolffd@0 66
wolffd@0 67 .val
wolffd@0 68 {
wolffd@0 69 font-family: Courier;
wolffd@0 70 color: green;
wolffd@0 71 }
wolffd@0 72
wolffd@0 73 .attr
wolffd@0 74 {
wolffd@0 75 font-family: Courier;
wolffd@0 76 font-weight: bold;
wolffd@0 77 }
wolffd@0 78
wolffd@0 79 .comp
wolffd@0 80 {
wolffd@0 81 }
wolffd@0 82
wolffd@0 83 .layout
wolffd@0 84 {
wolffd@0 85 }
wolffd@0 86
wolffd@0 87 .format
wolffd@0 88 {
wolffd@0 89 }
wolffd@0 90
wolffd@0 91 .note
wolffd@0 92 {
wolffd@0 93 }
wolffd@0 94
wolffd@0 95 .missing
wolffd@0 96 {
wolffd@0 97 color: lightgray;
wolffd@0 98 }
wolffd@0 99
wolffd@0 100 .heading
wolffd@0 101 {
wolffd@0 102 padding-left: 5px;
wolffd@0 103 padding-right: 5px;
wolffd@0 104 padding-top: 10px;
wolffd@0 105 padding-bottom: 2px;
wolffd@0 106
wolffd@0 107 color: gray;
wolffd@0 108 font-weight: bold;
wolffd@0 109 font-size: 60%;
wolffd@0 110 }
wolffd@0 111
wolffd@0 112 .text
wolffd@0 113 {
wolffd@0 114 padding-left: 20px;
wolffd@0 115 padding-bottom: 10px;
wolffd@0 116 padding-right: 10px;
wolffd@0 117 }
wolffd@0 118
wolffd@0 119 .index
wolffd@0 120 {
wolffd@0 121 padding-left: 20px;
wolffd@0 122 padding-right: 5px;
wolffd@0 123 padding-top: 2px;
wolffd@0 124 padding-bottom: 2px;
wolffd@0 125
wolffd@0 126 display: block;
wolffd@0 127 font-size: 80%;
wolffd@0 128
wolffd@0 129 color: blue;
wolffd@0 130 }
wolffd@0 131
wolffd@0 132 .index_selected
wolffd@0 133 {
wolffd@0 134 background: #8888FF;
wolffd@0 135 color: white;
wolffd@0 136 }
wolffd@0 137
wolffd@0 138 .content
wolffd@0 139 {
wolffd@0 140 display: none;
wolffd@0 141 }
wolffd@0 142
wolffd@0 143 .content_selected
wolffd@0 144 {
wolffd@0 145 display: block;
wolffd@0 146 }
wolffd@0 147 </style>
wolffd@0 148
wolffd@0 149 <script>
wolffd@0 150 <xsl:text disable-output-escaping="yes">
wolffd@0 151 var lastSelected = null;
wolffd@0 152
wolffd@0 153 function addClass (element, newClass)
wolffd@0 154 {
wolffd@0 155 if (element)
wolffd@0 156 {
wolffd@0 157 var classes = element.className.split (" ");
wolffd@0 158 for (var i = 0; i &lt; classes.length; ++i)
wolffd@0 159 if (classes [i] == newClass)
wolffd@0 160 break;
wolffd@0 161
wolffd@0 162 if (i == classes.length)
wolffd@0 163 {
wolffd@0 164 classes.push (newClass);
wolffd@0 165 element.className = classes.join (" ");
wolffd@0 166 }
wolffd@0 167 }
wolffd@0 168 }
wolffd@0 169
wolffd@0 170 function removeClass (element, oldClass)
wolffd@0 171 {
wolffd@0 172 if (element)
wolffd@0 173 {
wolffd@0 174 var classes = element.className.split (" ");
wolffd@0 175 for (var i = 0; i &lt; classes.length; ++i)
wolffd@0 176 if (classes [i] == oldClass)
wolffd@0 177 {
wolffd@0 178 classes.splice (i, 1);
wolffd@0 179 element.className = classes.join (" ");
wolffd@0 180 break;
wolffd@0 181 }
wolffd@0 182 }
wolffd@0 183 }
wolffd@0 184
wolffd@0 185
wolffd@0 186 function select (selected)
wolffd@0 187 {
wolffd@0 188 if (selected != lastSelected)
wolffd@0 189 {
wolffd@0 190 // deselect the last selection
wolffd@0 191 if (lastSelected)
wolffd@0 192 {
wolffd@0 193 removeClass (document.getElementById ("index_" + lastSelected.replace (':', '_')), "index_selected");
wolffd@0 194 removeClass (document.getElementById ("content_" + lastSelected.replace (':', '_')), "content_selected");
wolffd@0 195 }
wolffd@0 196
wolffd@0 197 lastSelected = selected;
wolffd@0 198
wolffd@0 199 var selectedIndex = document.getElementById ("index_" + lastSelected.replace (':', '_'));
wolffd@0 200 addClass (selectedIndex, "index_selected");
wolffd@0 201
wolffd@0 202 // ensure selected index is visible in indices source list
wolffd@0 203 if (selectedIndex)
wolffd@0 204 {
wolffd@0 205 var indexTop = selectedIndex.offsetTop;
wolffd@0 206 var indexBottom = indexTop + selectedIndex.offsetHeight;
wolffd@0 207 var indicesTop = selectedIndex.offsetParent.scrollTop;
wolffd@0 208 var indicesBottom = indicesTop + selectedIndex.offsetParent.offsetHeight;
wolffd@0 209 if (indexBottom &lt; indicesTop || indexTop &gt; indicesBottom)
wolffd@0 210 selectedIndex.scrollIntoView ();
wolffd@0 211 }
wolffd@0 212
wolffd@0 213 // display the content associated with the selected index
wolffd@0 214 addClass (document.getElementById ("content_" + lastSelected.replace (':', '_')), "content_selected");
wolffd@0 215 }
wolffd@0 216 return true;
wolffd@0 217
wolffd@0 218 }
wolffd@0 219
wolffd@0 220 function hashed ()
wolffd@0 221 {
wolffd@0 222 // check if we navigated to a new internal location e.g. via the back button
wolffd@0 223 // if so we need to update the selection
wolffd@0 224 // NOTE: this means there are no real anchors in the HTML at all, we're just simulating them
wolffd@0 225 var hash = window.location.hash;
wolffd@0 226 if (hash &amp;&amp; hash.charAt (0) == '#')
wolffd@0 227 select (hash.substr (1));
wolffd@0 228 else
wolffd@0 229 select ("h:introduction");
wolffd@0 230 return true;
wolffd@0 231 }
wolffd@0 232
wolffd@0 233 function clicked (event)
wolffd@0 234 {
wolffd@0 235 // check to see if an internal link was clicked, if so we need to update the selection
wolffd@0 236 // NOTE: this is not strictly necessary since hashed () will catch it but it helps with the responsiveness
wolffd@0 237 var clickedElement = event.target;
wolffd@0 238 if (!clickedElement)
wolffd@0 239 clickedElement = event.srcElement;
wolffd@0 240 switch (clickedElement.tagName)
wolffd@0 241 {
wolffd@0 242 case 'a':
wolffd@0 243 case 'A':
wolffd@0 244 var oldHref = window.location.href;
wolffd@0 245 var oldHash = oldHref.indexOf ('#');
wolffd@0 246 if (oldHash == -1)
wolffd@0 247 oldHash = oldHref.length;
wolffd@0 248
wolffd@0 249 var newHref = clickedElement.href;
wolffd@0 250 var newHash = newHref.indexOf ('#');
wolffd@0 251 if (newHash == -1)
wolffd@0 252 newHash = newHref.length;
wolffd@0 253
wolffd@0 254 if (oldHref.substr (0, oldHash) == newHref.substr (0, newHash))
wolffd@0 255 {
wolffd@0 256 if (newHash &lt; newHref.length)
wolffd@0 257 select (newHref.substr (newHash + 1));
wolffd@0 258 else
wolffd@0 259 select ("h:introduction");
wolffd@0 260 }
wolffd@0 261 break;
wolffd@0 262 }
wolffd@0 263 return true;
wolffd@0 264 }
wolffd@0 265
wolffd@0 266 function loaded ()
wolffd@0 267 {
wolffd@0 268 hashed ();
wolffd@0 269 window.setInterval ("hashed ()", 1000);
wolffd@0 270 return true;
wolffd@0 271 }
wolffd@0 272 </xsl:text>
wolffd@0 273 </script>
wolffd@0 274
wolffd@0 275 </head>
wolffd@0 276 <body onload="return loaded ()" onclick="return clicked (event)">
wolffd@0 277 <div id="indices">
wolffd@0 278
wolffd@0 279 <!-- display all the attribute type names -->
wolffd@0 280 <div class="heading">NOTES</div>
wolffd@0 281 <xsl:for-each select="/xsd:schema/xsd:annotation[@id]">
wolffd@0 282 <a id="index_h_{@id}" class="index note" href="#h:{@id}">
wolffd@0 283 <xsl:value-of select="@id" />
wolffd@0 284 </a>
wolffd@0 285 </xsl:for-each>
wolffd@0 286
wolffd@0 287 <!-- display all the attribute names -->
wolffd@0 288 <div class="heading">ATTRIBUTES</div>
wolffd@0 289 <xsl:for-each select="/xsd:schema/xsd:attribute">
wolffd@0 290 <a id="index_d_{@name}" class="index attr" href="#d:{@name}">
wolffd@0 291 <xsl:value-of select="@name" />
wolffd@0 292 </a>
wolffd@0 293 </xsl:for-each>
wolffd@0 294
wolffd@0 295 <!-- display all the attribute type names -->
wolffd@0 296 <div class="heading">TYPES</div>
wolffd@0 297 <xsl:for-each select="/xsd:schema/xsd:simpleType">
wolffd@0 298 <a id="index_k_{@name}" class="index type" href="#k:{@name}">
wolffd@0 299 <xsl:value-of select="@name" />
wolffd@0 300 </a>
wolffd@0 301 </xsl:for-each>
wolffd@0 302
wolffd@0 303
wolffd@0 304
wolffd@0 305 </div>
wolffd@0 306 <div id="contents">
wolffd@0 307
wolffd@0 308 <!-- note content -->
wolffd@0 309 <xsl:for-each select="/xsd:schema/xsd:annotation[@id]">
wolffd@0 310 <div id="content_h_{@id}" class="content">
wolffd@0 311 <div class="text">
wolffd@0 312 <xsl:apply-templates select="xsd:documentation/*" mode="html" />
wolffd@0 313 </div>
wolffd@0 314 </div>
wolffd@0 315 </xsl:for-each>
wolffd@0 316
wolffd@0 317 <!-- attribute content -->
wolffd@0 318 <xsl:for-each select="/xsd:schema/xsd:attribute">
wolffd@0 319 <div id="content_d_{@name}" class="content">
wolffd@0 320
wolffd@0 321 <!-- display the layouts this attribute applies to -->
wolffd@0 322 <div class="heading">LAYOUTS</div>
wolffd@0 323 <div class="text">
wolffd@0 324 <xsl:variable name="attributeLayouts" select="@gv:layouts" />
wolffd@0 325 <xsl:for-each select="$arguments/xsd:schema/xsd:simpleType[@name='layout']/xsd:restriction/xsd:enumeration">
wolffd@0 326 <span class="layout">
wolffd@0 327 <xsl:attribute name="class">layout <xsl:if test="$attributeLayouts and not(contains(concat(' ',$attributeLayouts,' '),concat(' ',@value,' ')))">missing</xsl:if></xsl:attribute>
wolffd@0 328 <xsl:value-of select="@value" />
wolffd@0 329 </span>
wolffd@0 330 <xsl:text> </xsl:text>
wolffd@0 331 </xsl:for-each>
wolffd@0 332 </div>
wolffd@0 333
wolffd@0 334 <!-- display the components this attribute is used by -->
wolffd@0 335 <div class="heading">COMPONENTS</div>
wolffd@0 336 <div class="text">
wolffd@0 337 <xsl:variable name="attributeName" select="@name" />
wolffd@0 338 <xsl:for-each select="/xsd:schema/xsd:complexType">
wolffd@0 339 <span class="comp">
wolffd@0 340 <xsl:attribute name="class">comp <xsl:if test="not(xsd:attribute[@ref=$attributeName])">missing</xsl:if></xsl:attribute>
wolffd@0 341 <xsl:value-of select="@name" />
wolffd@0 342 </span>
wolffd@0 343 <xsl:text> </xsl:text>
wolffd@0 344 </xsl:for-each>
wolffd@0 345 </div>
wolffd@0 346
wolffd@0 347 <!-- display the formats this attribute can output -->
wolffd@0 348 <div class="heading">FORMATS</div>
wolffd@0 349 <div class="text">
wolffd@0 350 <xsl:choose>
wolffd@0 351 <xsl:when test="@gv:formats">
wolffd@0 352 <span class="format"><xsl:value-of select="@gv:formats" /></span>
wolffd@0 353 </xsl:when>
wolffd@0 354 <xsl:otherwise>
wolffd@0 355 <span class="format missing">all</span>
wolffd@0 356 </xsl:otherwise>
wolffd@0 357 </xsl:choose>
wolffd@0 358 </div>
wolffd@0 359
wolffd@0 360 <!-- display the type of this attribute -->
wolffd@0 361 <div class="heading">TYPE</div>
wolffd@0 362 <div class="text">
wolffd@0 363 <xsl:choose>
wolffd@0 364 <xsl:when test="@type='xsd:anyURI'">
wolffd@0 365 <span class="type">URL</span>
wolffd@0 366 </xsl:when>
wolffd@0 367 <xsl:when test="@type='xsd:boolean'">
wolffd@0 368 <span class="type">bool</span>
wolffd@0 369 </xsl:when>
wolffd@0 370 <xsl:when test="@type='xsd:decimal'">
wolffd@0 371 <span class="type">double</span>
wolffd@0 372 </xsl:when>
wolffd@0 373 <xsl:when test="@type='xsd:integer'">
wolffd@0 374 <span class="type">int</span>
wolffd@0 375 </xsl:when>
wolffd@0 376 <xsl:when test="@type='xsd:string'">
wolffd@0 377 <span class="type">string</span>
wolffd@0 378 </xsl:when>
wolffd@0 379 <xsl:when test="not(contains(@type,':'))">
wolffd@0 380 <a class="type" href="#k:{@type}"><xsl:value-of select="@type" /></a>
wolffd@0 381 </xsl:when>
wolffd@0 382 </xsl:choose>
wolffd@0 383 </div>
wolffd@0 384
wolffd@0 385 <!-- display the attribute default or none if missing -->
wolffd@0 386 <div class="heading">DEFAULT</div>
wolffd@0 387 <div class="text">
wolffd@0 388 <xsl:choose>
wolffd@0 389 <xsl:when test="@default">
wolffd@0 390 <span class="val">
wolffd@0 391 <xsl:value-of select="@default" />
wolffd@0 392 </span>
wolffd@0 393 </xsl:when>
wolffd@0 394 <xsl:otherwise>
wolffd@0 395 <span class="val missing">none</span>
wolffd@0 396 </xsl:otherwise>
wolffd@0 397 </xsl:choose>
wolffd@0 398 </div>
wolffd@0 399
wolffd@0 400 <!-- display the description from the documentation bits -->
wolffd@0 401 <div class="heading">DESCRIPTION</div>
wolffd@0 402 <div class="text">
wolffd@0 403 <xsl:apply-templates select="xsd:annotation/xsd:documentation/*" mode="html" />
wolffd@0 404 </div>
wolffd@0 405
wolffd@0 406 </div>
wolffd@0 407 </xsl:for-each>
wolffd@0 408
wolffd@0 409 <!-- attribute type content -->
wolffd@0 410 <xsl:for-each select="/xsd:schema/xsd:simpleType">
wolffd@0 411 <div id="content_k_{@name}" class="content">
wolffd@0 412
wolffd@0 413 <!-- display the values if this is an enumeration -->
wolffd@0 414 <xsl:if test="xsd:restriction/xsd:enumeration">
wolffd@0 415 <div class="heading">VALUES</div>
wolffd@0 416 <div class="text">
wolffd@0 417 <xsl:for-each select="xsd:restriction/xsd:enumeration">
wolffd@0 418 <span class="val"><xsl:value-of select="@value" /></span>
wolffd@0 419 <xsl:text> </xsl:text>
wolffd@0 420 </xsl:for-each>
wolffd@0 421 </div>
wolffd@0 422 </xsl:if>
wolffd@0 423
wolffd@0 424 <!-- display the description from the documentation bits -->
wolffd@0 425 <div class="heading">DESCRIPTION</div>
wolffd@0 426 <div class="text">
wolffd@0 427 <xsl:apply-templates select="xsd:annotation/xsd:documentation/*" mode="html" />
wolffd@0 428 </div>
wolffd@0 429 </div>
wolffd@0 430 </xsl:for-each>
wolffd@0 431
wolffd@0 432
wolffd@0 433
wolffd@0 434 </div>
wolffd@0 435 </body>
wolffd@0 436 </html>
wolffd@0 437 </xsl:template>
wolffd@0 438
wolffd@0 439
wolffd@0 440
wolffd@0 441
wolffd@0 442 <xsl:template match="html:a[@rel='attr']" mode="html" xmlns:html="http://www.w3.org/1999/xhtml">
wolffd@0 443 <a href="#d:{text()}" class="attr">
wolffd@0 444 <xsl:apply-templates select="@*|node()" mode="html" />
wolffd@0 445 </a>
wolffd@0 446 </xsl:template>
wolffd@0 447
wolffd@0 448 <xsl:template match="html:a[@rel='type']" mode="html" xmlns:html="http://www.w3.org/1999/xhtml">
wolffd@0 449 <a href="#k:{text()}" class="type">
wolffd@0 450 <xsl:apply-templates select="@*|node()" mode="html" />
wolffd@0 451 </a>
wolffd@0 452 </xsl:template>
wolffd@0 453
wolffd@0 454 <xsl:template match="html:a[@rel='note']" mode="html" xmlns:html="http://www.w3.org/1999/xhtml">
wolffd@0 455 <a href="#h:{text()}" class="note">
wolffd@0 456 <xsl:apply-templates select="@*|node()" mode="html" />
wolffd@0 457 </a>
wolffd@0 458 </xsl:template>
wolffd@0 459
wolffd@0 460 <xsl:template match="@*|node()" mode="html">
wolffd@0 461 <xsl:copy>
wolffd@0 462 <xsl:apply-templates select="@*|node()" mode="html" />
wolffd@0 463 </xsl:copy>
wolffd@0 464 </xsl:template>
wolffd@0 465
wolffd@0 466
wolffd@0 467 </xsl:stylesheet>