Both sides previous revision
Poprzednia wersja
|
|
pl:miw:miw08_xtt_rif:verb [2008/04/26 15:54] miw |
pl:miw:miw08_xtt_rif:verb [2019/06/27 15:50] (aktualna) |
| ====== Werbalizacja RIF za pomocą XSLT ====== |
| <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="Group"> |
| < html>< body> |
| <xsl:for-each select="./sentence"> |
| If |
| <xsl:choose> |
| <xsl:when test="./Implies/if/Or"> |
| <xsl:for-each select="./Implies/if/Or/formula"> |
| <xsl:choose> |
| <xsl:when test="./Equal"> |
| <b><xsl:value-of select="./Equal/side/Var"/></b> is <b><xsl:value-of select="./Equal/side/Const"/></b> |
| </xsl:when> |
| <xsl:when test="./Atom"> |
| <xsl:apply-templates select="./Atom"/> is true |
| </xsl:when> |
| <xsl:when test="./External"> |
| External <xsl:apply-templates select="./External/content/Expr|./External/content/Atom"/> is true |
| </xsl:when> |
| </xsl:choose> |
| <xsl:if test="position() != last()"> |
| or |
| </xsl:if> |
| </xsl:for-each> |
| </xsl:when> |
| <xsl:when test="./Implies/if/And"> |
| <xsl:for-each select="./Implies/if/And/formula"> |
| <xsl:choose> |
| <xsl:when test="./Equal"> |
| <b><xsl:value-of select="./Equal/side/Var"/></b> is <b><xsl:value-of select="./Equal/side/Const"/></b> |
| </xsl:when> |
| <xsl:when test="./Atom"> |
| <xsl:apply-templates select="./Atom"/> is true |
| </xsl:when> |
| <xsl:when test="./External"> |
| External <xsl:apply-templates select="./External/content/Expr|./External/content/Atom"/> is true |
| </xsl:when> |
| </xsl:choose> |
| <xsl:if test="position() != last()"> |
| And |
| </xsl:if> |
| </xsl:for-each> |
| </xsl:when> |
| <xsl:otherwise> |
| <xsl:choose> |
| <xsl:when test="./Implies/if/Equal"> |
| <b><xsl:value-of select="./Implies/if/formula/Equal/side/Var"/></b> is <b><xsl:value-of select="./Implies/if/formula/Equal/side/Const"/></b> |
| </xsl:when> |
| <xsl:when test="./Implies/if/Atom"> |
| <xsl:apply-templates select="./Implies/if/Atom"/> is true |
| </xsl:when> |
| <xsl:when test="./Implies/if/External"> |
| <xsl:apply-templates select="./Implies/if/External/content/Atom|./Implies/if/formula/External/content/Expr"/> is true |
| </xsl:when> |
| </xsl:choose> |
| </xsl:otherwise> |
| </xsl:choose> |
| <xsl:choose> |
| <xsl:when test="./Implies/then/Atom"> |
| then <xsl:apply-templates select="./Implies/then/Atom"/>.<br/> |
| </xsl:when> |
| <xsl:when test="./Implies/then/External"> |
| then External <xsl:apply-templates select="./Implies/then/External/content/Expr|./Implies/then/External/content/Atom"/>.<br/> |
| </xsl:when> |
| </xsl:choose> |
| </xsl:for-each> |
| < /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]] |