[13] | 1 | <?xml version="1.0"?> |
---|
| 2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
---|
| 3 | |
---|
| 4 | <xsl:template match="/"> |
---|
| 5 | <html><body> |
---|
| 6 | <xsl:apply-templates select="framscontext"/> |
---|
| 7 | </body></html> |
---|
| 8 | </xsl:template> |
---|
| 9 | |
---|
| 10 | <xsl:template match="framscontext"> |
---|
[264] | 11 | <style> |
---|
| 12 | .file {color:red;} |
---|
| 13 | .context-code {color: #00ee00;} |
---|
| 14 | .context-file {color: #007700;} |
---|
| 15 | .objects {color: #0000ff;} |
---|
| 16 | </style> |
---|
| 17 | |
---|
[13] | 18 | <h1>Framscript Context Configuration</h1> |
---|
[264] | 19 | |
---|
| 20 | <b>Each <span class="file">file type</span> may contain <span class="objects">objects</span> from many <span class="context-file">contexts</span>, as specified below.<br/>Each <span class="context-file">context</span> may contain many <span class="objects">objects</span>, as specified below.<br/>Note: |
---|
[13] | 21 | <xsl:choose><xsl:when test="count(document('framscript.xml')/framscript)=0"> |
---|
[264] | 22 | This formatting sheet (xsl) would use <a href="framscript.xml">framscript.xml</a> to show object names if that file was available!</xsl:when> |
---|
| 23 | <xsl:otherwise>This formatting sheet (xsl) includes object names extracted from <a href="framscript.xml">framscript.xml</a>.</xsl:otherwise> |
---|
[13] | 24 | </xsl:choose> |
---|
[264] | 25 | </b><br/><br/><br/> |
---|
[13] | 26 | |
---|
| 27 | <table border="1"> |
---|
| 28 | <th>File types</th><th>Contents</th><th>Examples</th> |
---|
| 29 | <xsl:apply-templates select="file"/> |
---|
| 30 | </table> |
---|
| 31 | </xsl:template> |
---|
| 32 | |
---|
| 33 | <xsl:template match="file"> |
---|
| 34 | <tr valign="top"> |
---|
[264] | 35 | <td class="file"><b><xsl:value-of select="@label"/></b><br/><xsl:value-of select="@pattern"/></td> |
---|
[13] | 36 | <td> |
---|
| 37 | <xsl:if test="count(code)!=0"> |
---|
| 38 | <p title="Defined by <objects>"> |
---|
[264] | 39 | Objects defined in the following contexts can be stored directly in the file (using the standard Framsticks <a href="http://www.framsticks.com/common/formatspec.html">format</a>):<ul><xsl:apply-templates select="objects"/></ul> |
---|
[13] | 40 | </p> |
---|
| 41 | <xsl:apply-templates select="code"/> |
---|
| 42 | </xsl:if> |
---|
| 43 | <xsl:if test="count(script)!=0"> |
---|
| 44 | <p title="Defined by <script>"> |
---|
| 45 | Contains the script (plain text format) accessing objects defined in the following contexts:<ul><xsl:apply-templates select="script"/></ul> |
---|
| 46 | </p> |
---|
| 47 | </xsl:if> |
---|
| 48 | <xsl:if test="count(properties)!=0"> |
---|
| 49 | <p title="Defined by <properties>"> |
---|
| 50 | Special objects properties are created according to property definitions in the file:<ul><xsl:apply-templates select="properties"/></ul> |
---|
| 51 | </p> |
---|
| 52 | </xsl:if> |
---|
| 53 | </td> |
---|
| 54 | <td><i>sample <xsl:value-of select="@pattern"/> file</i><br/> |
---|
| 55 | <pre style="background:#eeeeee;"> |
---|
| 56 | <xsl:if test="count(code)!=0"> |
---|
| 57 | # object defined in "<xsl:value-of select="objects[1]/@context"/>" |
---|
| 58 | object: |
---|
| 59 | field_1:... |
---|
| 60 | field_2:... |
---|
| 61 | </xsl:if> |
---|
| 62 | |
---|
| 63 | <xsl:if test="count(code)!=0"> |
---|
| 64 | # sample object that contains the script: |
---|
| 65 | <xsl:value-of select="code[1]/@object"/>: |
---|
| 66 | field_1:... |
---|
| 67 | field_2:... |
---|
| 68 | <xsl:value-of select="code[1]/@member"/>:~ |
---|
| 69 | function fun() |
---|
| 70 | { |
---|
| 71 | // using some objects from "<xsl:value-of select="code[1]/context[1]/@name"/>" |
---|
| 72 | } |
---|
| 73 | ~ |
---|
| 74 | </xsl:if> |
---|
| 75 | <xsl:if test="count(properties)!=0"> |
---|
| 76 | # this property will be visible as "<xsl:value-of select="properties[1]/@to"/>.field" |
---|
| 77 | <xsl:value-of select="properties[1]/@from"/>: |
---|
| 78 | id:field |
---|
| 79 | name:My property |
---|
| 80 | ... |
---|
| 81 | </xsl:if> |
---|
| 82 | |
---|
| 83 | <xsl:if test="count(script)!=0"> |
---|
| 84 | // script directly in the file |
---|
| 85 | function fun() |
---|
| 86 | { |
---|
| 87 | // using some objects from <xsl:value-of select="script[1]/@context"/> |
---|
| 88 | } |
---|
| 89 | </xsl:if> |
---|
| 90 | |
---|
| 91 | </pre> |
---|
| 92 | </td> |
---|
| 93 | </tr> |
---|
| 94 | </xsl:template> |
---|
| 95 | |
---|
[264] | 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | <xsl:template name="extobjects"> |
---|
| 100 | <xsl:param name="objs"/> |
---|
| 101 | <xsl:if test="count($objs)!=0"> |
---|
| 102 | ( |
---|
| 103 | <xsl:for-each select="$objs"> |
---|
| 104 | <font class="objects"><xsl:value-of select="@name"/></font>, |
---|
| 105 | </xsl:for-each> |
---|
| 106 | ) |
---|
| 107 | </xsl:if> |
---|
| 108 | </xsl:template> |
---|
| 109 | |
---|
| 110 | |
---|
[13] | 111 | <xsl:template match="objects"> |
---|
[264] | 112 | <li><b><span class="context-file"><xsl:value-of select="@context"/></span></b> |
---|
[13] | 113 | <xsl:variable name="context" select="@context"/> |
---|
| 114 | <xsl:call-template name="extobjects"><xsl:with-param name="objs" select="document('framscript.xml')/framscript/type[@context=$context]"/></xsl:call-template> |
---|
| 115 | </li> |
---|
| 116 | </xsl:template> |
---|
| 117 | |
---|
| 118 | <xsl:template match="script"> |
---|
[264] | 119 | <li><b><span class="context-code"><xsl:value-of select="@context"/></span></b> |
---|
[13] | 120 | <xsl:variable name="context" select="@context"/> |
---|
| 121 | <xsl:call-template name="extobjects"><xsl:with-param name="objs" select="document('framscript.xml')/framscript/type[@context=$context]"/></xsl:call-template> |
---|
| 122 | </li> |
---|
| 123 | </xsl:template> |
---|
| 124 | |
---|
| 125 | <xsl:template match="context"> |
---|
[264] | 126 | <li><b><span class="context-code"><xsl:value-of select="@name"/></span></b> |
---|
[13] | 127 | <xsl:variable name="context" select="@name"/> |
---|
| 128 | <xsl:call-template name="extobjects"><xsl:with-param name="objs" select="document('framscript.xml')/framscript/type[@context=$context]"/></xsl:call-template> |
---|
| 129 | </li> |
---|
| 130 | </xsl:template> |
---|
| 131 | |
---|
[264] | 132 | |
---|
| 133 | |
---|
[13] | 134 | <xsl:template match="code"> |
---|
| 135 | <p title="Defined by <code>"> |
---|
| 136 | "<xsl:value-of select="@member"/>:" field of "<xsl:value-of select="@object"/>:" contains a script that can access objects defined in the following contexts:<ul><xsl:apply-templates select="context"/></ul> |
---|
| 137 | </p> |
---|
| 138 | </xsl:template> |
---|
| 139 | |
---|
| 140 | <xsl:template match="properties"> |
---|
| 141 | <li> |
---|
[264] | 142 | <span class="objects"><b><xsl:value-of select="@to"/></b></span> is defined by <span class="objects"><xsl:value-of select="@from"/></span> objects |
---|
[13] | 143 | </li> |
---|
| 144 | </xsl:template> |
---|
| 145 | |
---|
| 146 | </xsl:stylesheet> |
---|