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