To jest stara wersja strony!
Werbalizacja RIF za pomocą XSLT
<?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="/">
<xsl:for-each select="Ruleset/rule">
If
<xsl:choose>
<xsl:when test="./formula/Implies/if/Or">
<xsl:for-each select="./formula/Implies/if/Or/formula">
<xsl:choose>
<xsl:when test="./Equal">
<b><xsl:value-of select="./Equal/arg/Var"/></b> is <b><xsl:value-of select="./Equal/arg/Const"/></b>
</xsl:when>
<xsl:when test="./Uniterm">
<b><xsl:value-of select="./Uniterm/op/Const"/>(</b>
<xsl:for-each select="./Uniterm/arg">
<xsl:choose>
<xsl:when test="./Var">
var <b><xsl:value-of select="./Var"/></b>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./Const"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position() != last()">
,
</xsl:if>
</xsl:for-each>
<b>)</b> is true
</xsl:when>
</xsl:choose>
<xsl:if test="position() != last()">
or
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:when test="./formula/Implies/if/And">
<xsl:for-each select="./formula/Implies/if/And/formula">
<xsl:choose>
<xsl:when test="./Equal">
<b><xsl:value-of select="./Equal/arg/Var"/></b> is <b><xsl:value-of select="./Equal/arg/Const"/></b>
</xsl:when>
<xsl:when test="./Uniterm">
<b><xsl:value-of select="./Uniterm/op/Const"/>(</b>
<xsl:for-each select="./Uniterm/arg">
<xsl:choose>
<xsl:when test="./Var">
var <b><xsl:value-of select="./Var"/></b>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./Const"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position() != last()">
,
</xsl:if>
</xsl:for-each>
<b>)</b> 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="./formula/Implies/if/formula/Equal">
<b><xsl:value-of select="./formula/Implies/if/formula/Equal/arg/Var"/></b> is <b><xsl:value-of select="./formula/Implies/if/formula/Equal/arg/Const"/></b>
</xsl:when>
<xsl:when test="./formula/Implies/if/formula/Uniterm">
<b><xsl:value-of select="./formula/Implies/if/formula/Uniterm/op/Const"/>(</b>
<xsl:for-each select="./formula/Implies/if/formula/Uniterm/arg">
<xsl:choose>
<xsl:when test="./Var">
var <b><xsl:value-of select="./Var"/></b>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./Const"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position() != last()">
,
</xsl:if>
</xsl:for-each>
<b>)</b> is true
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
then <b><xsl:value-of select="./formula/Implies/then/Uniterm/arg/*"/></b> is <b><xsl:value-of select="./formula/Implies/then/Uniterm/op/Const"/></b>.<br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Powrót do dokumentu