Мне нужно сравнить узлы между братьями и сестрами.
<Snoopy revision="0" version="0">
<pnml>
<net id="1" name="contenda" type="IOPT">
<conflict id="22">
<group id="0">
<g_priority>1</g_priority>
<g_transition id="9"/>
<g_place id="1">
<g_arc id="12"/>
</g_place>
<g_place id="3">
<g_arc id="13"/>
</g_place>
</group>
<group id="1">
<g_priority>2</g_priority>
<g_transition id="10"/>
<g_place id="3">
<g_arc id="14"/>
</g_place>
<g_place id="5">
<g_arc id="15"/>
</g_place>
</group>
<group id="2">
<g_priority>3</g_priority>
<g_transition id="11"/>
<g_place id="5">
<g_arc id="16"/>
</g_place>
<g_place id="7">
<g_arc id="17"/>
</g_place>
</group>
</conflict>
</net>
</pnml>
</Snoopy>
Из предыдущего кода, скажем, я нахожусь в "group id = 1". Поэтому я хочу сравнить все идентификаторы "g_place" из этой группы со всеми идентификаторами "g_place" из предыдущего брата. В основном я хочу увидеть, есть ли дубликаты. Если есть дубликаты, определенное условие должно быть вызвано, иначе это вызовет другое условие. Вот код, который у меня есть:
xmlns:math="http://exslt.org/math" xmlns:exslt="http://exslt.org/common"
extension-element-prefixes="math exslt MSXML">
<xsl:key name="conflict" match="conflict" use="@id" />
<xsl:template name="proc-conflict" match="conflict">
<xsl:variable name="conflict_id" select="@id" />
<xsl:for-each select="key('conflict', $conflict_id)/group">
<xsl:sort select="g_priority" order="ascending" data-type="number" />
<xsl:variable name="g_priority" select="./g_priority" />
<xsl:choose>
<xsl:when test="$g_priority = '1'">
<xsl:text> If </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="../preceding-sibling::group/g_place = ./g_place">
<xsl:text> Elsif </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> If </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Спасибо