How should I design the rule, that changes the IsLocked
(child) field on change of the State
field in parent?
Solution: Use the Complex Data Rule like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="AS date">
<xsl:include href="model://e1c65fcd-118d-4eb3-9c2f-aa27fec132ba"/>
<xsl:template match="ROOT">
<ROOT>
<xsl:apply-templates select="//ChildEntityName"/>
</ROOT>
</xsl:template>
<xsl:template match="ChildEntityName">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="IsLocked">
<xsl:value-of select="not(../@State=1)"/>
</xsl:attribute>
<xsl:copy-of select="*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
In this case, if the State
in parent stays different from 1, the IsLocked
field in child changes to True
. If it changes to 1, it changes to False
.