Both sides previous revision
Poprzednia wersja
|
|
pl:miw:miw08_xtt_rif:visual [2008/04/23 22:25] miw aktualizacja |
pl:miw:miw08_xtt_rif:visual [2019/06/27 15:50] (aktualna) |
| ===== Wizualizacja reguł RIF ===== |
| <code xml> |
| <?xml version="1.0" encoding="ISO-8859-1"?> |
| |
| <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> |
| <xsl:template match="/"> |
| < html> |
| <head> |
| <title>RIF Visualisation</title> |
| </head> |
| < body> |
| <div style="border: 1px solid #ff8400; background-color: #ffd45f; padding: 5px 5px 5px 5px;"> |
| <div style="font-size: 25px; font-family: Verdana, Sans; font-weight: bold; padding: 0px 0px 0px 0px; margin-bottom: 10px;">Group</div> |
| <xsl:for-each select="Group/sentence"> |
| <div id="cond" style="border: 1px solid #5b5b5b; padding: 5px 5px 5px 5px; font-size: 13px; margin-bottom: 10px; background-color: #ffbb00;"> |
| <div style="font-size: 18px; font-family: Verdana, Sans; font-weight: bold; padding: 0px; margin-bottom: 5px;">Rule <xsl:value-of select="position()"/></div> |
| <xsl:choose> |
| <xsl:when test="./Implies/if/Or"> |
| <div><b>One</b> of the conditions must be true |
| <ul> |
| <xsl:for-each select="./Implies/if/Or/formula"> |
| <xsl:choose> |
| <xsl:when test="./Equal"> |
| <li><xsl:value-of select="./Equal/side[1]/*"/> == <xsl:value-of select="./Equal/side[2]/*"/></li> |
| </xsl:when> |
| <xsl:when test="./Atom"> |
| <li><xsl:apply-templates select="./Atom"/> == true</li> |
| </xsl:when> |
| <xsl:when test="./External"> |
| <li>External <xsl:apply-templates select="./External/content/Expr|./External/content/Atom"/> == true</li> |
| </xsl:when> |
| </xsl:choose> |
| </xsl:for-each> |
| </ul></div> |
| </xsl:when> |
| <xsl:when test="./Implies/if/And"> |
| <div><b>All</b> conditions must be true |
| <ul> |
| <xsl:for-each select="./Implies/if/And/formula"> |
| <xsl:choose> |
| <xsl:when test="./Equal"> |
| <li><xsl:value-of select="./Equal/side[1]/*"/> == <xsl:value-of select="./Equal/side[2]/*"/></li> |
| </xsl:when> |
| <xsl:when test="./Atom"> |
| <li><xsl:apply-templates select="./Atom"/> == true</li> |
| </xsl:when> |
| <xsl:when test="./External"> |
| <li>External <xsl:apply-templates select="./External/content/Expr|./External/content/Atom"/> == true</li> |
| </xsl:when> |
| </xsl:choose> |
| </xsl:for-each> |
| </ul></div> |
| </xsl:when> |
| <xsl:otherwise> |
| <div>Condition must be true<br/> |
| <xsl:choose> |
| <xsl:when test="./Implies/if/Equal"> |
| <xsl:value-of select="./Implies/if/Equal/side[1]/*"/> == <xsl:value-of select="./Implies/if/Equal/side[2]/*"/> |
| </xsl:when> |
| <xsl:when test="./Implies/if/Atom"> |
| <xsl:apply-templates select="./Implies/if/Atom"/> == true |
| </xsl:when> |
| <xsl:when test="./Implies/if/External"> |
| <xsl:apply-templates select="./Implies/if/External/content/Atom|./Implies/if/formula/External/content/Expr"/> == true |
| </xsl:when> |
| </xsl:choose> |
| </div> |
| </xsl:otherwise> |
| </xsl:choose> |
| <div id="cond"> |
| <xsl:choose> |
| <xsl:when test="./Implies/then/Atom"> |
| <b>then</b> assert <xsl:apply-templates select="./Implies/then/Atom"/> |
| </xsl:when> |
| <xsl:when test="./Implies/then/External"> |
| <b>then</b> assert External <xsl:apply-templates select="./Implies/then/External/content/Expr|./Implies/then/External/content/Atom"/> |
| </xsl:when> |
| </xsl:choose> |
| </div> |
| </div> |
| </xsl:for-each> |
| </div> |
| </body> |
| </html> |
| </xsl:template> |
| |
| <xsl:template match="arg"> |
| <xsl:choose> |
| <xsl:when test="./Var"> |
| var <xsl:value-of select="./Var"/> |
| </xsl:when> |
| <xsl:when test="./Const"> |
| <xsl:value-of select="./Const"/> |
| </xsl:when> |
| <xsl:when test="./External/content"> |
| External <xsl:apply-templates select="./External/content/Expr|./External/content/Atom"/> |
| </xsl:when> |
| <xsl:when test="./Atom"> |
| <xsl:apply-templates select="./Atom"/> |
| </xsl:when> |
| </xsl:choose> |
| </xsl:template> |
| |
| <xsl:template match="Atom"> |
| <xsl:for-each select="./*"> |
| <xsl:choose> |
| <xsl:when test="name() = 'op'"> |
| <b><xsl:value-of select="./Const"/>(</b> |
| </xsl:when> |
| <xsl:otherwise> |
| <xsl:apply-templates select="."/> |
| <xsl:if test="position() != last()">, </xsl:if> |
| </xsl:otherwise> |
| </xsl:choose> |
| </xsl:for-each> |
| <b>)</b> |
| </xsl:template> |
| |
| <xsl:template match="Expr"> |
| <xsl:for-each select="./*"> |
| <xsl:choose> |
| <xsl:when test="./Const"> |
| <b><xsl:value-of select="./Const"/>(</b> |
| </xsl:when> |
| <xsl:otherwise> |
| <xsl:apply-templates select="."/> |
| <xsl:if test="position() != last()">, </xsl:if> |
| </xsl:otherwise> |
| </xsl:choose> |
| </xsl:for-each> |
| <b>)</b> |
| </xsl:template> |
| |
| </xsl:stylesheet> |
| </code> |
| [[pl:miw:miw08_xtt_rif|Powrót do dokumentu]] |