xsl-list
[Top] [All Lists]

Comparing node for identity using union

2005-01-13 14:32:22
I don't know what's happenend in here, but i was using the union
operator for comparing nodes, following M. Kay sugestion some weeks
ago. It was working OK then, but now it simple stop working. I don't
believe in witches, but as the Spaniards says "que las hay, hay"...

What i was doing was something like this:

        <xsl:param name="pos" select="0"/>
        <xsl:variable name="snode" select="(//Menu)[$pos]"/>
(...)

                                                        <xsl:when 
test="(count(parent::Menu|$snode)=1)">
                                                                
<xsl:text>1</xsl:text>
                                                        </xsl:when>

aplyed to something like

<Menus>
    <Menu>
        <Menu_K>X00043</Menu_K>
        <Titulo>Processos</Titulo>
        <Menu>
            <Menu_K>X00047</Menu_K>
            <Titulo>Caracterização</Titulo>
        </Menu>
    </Menu>
    <Menu>
        <Menu_K>X00047</Menu_K>
        <Titulo>Caracterização</Titulo>
    </Menu>
    <Menu>
        <Menu_K>X00110</Menu_K>
        <Titulo>Setting's</Titulo>
        <Menu>
            <Menu_K>X00110</Menu_K>
            <Titulo>Setting's</Titulo>
        </Menu>
    </Menu>
</Menus>

In this example when the context node is /Menus/Menu/Menu and $pos=1 i
want the value 1, otherwise something else.

When $pos = 0 i never want that condition true, and everithing was
working OK. But now i only changed the tag names and it's not working
anymore. I run to the debuger i see that

(count(parent::Menu|$snode)=1) is allways true, even when $snode no
node, and even when there is no parent::Menu .

For example, when in  /Menus/Menu/Menu and (//Menu)[0] that condition is true. 

I'm completly lost in here, its late and i don't know what to think...

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--