xsl-list
[Top] [All Lists]

Re: [xsl] Key to select all same nodes(same @id) except current node

2007-03-07 12:09:51
Thanks Michael. :)

<xsl:for-each 
select="key('ParentKey',@id)[not(generate-id()=generate-id(current()))]">
                    <xsl:variable name="parentvar" select="."> <!-- it selects 
current node, Needs to check whether its grand parent is 'category or not' -->
                    </xsl:variable>
                    <xsl:if test="name(ancestor::$parentvar[2]) = 'category'">
                        <samenode>
                            <xsl:value-of 
select="ancestor::$parentvar[2]/@id"></xsl:value-of>
                        </samenode>
                    </xsl:if>
                </xsl:for-each>

Could you please tell me what is wrong in xpath "ancestor::$parentvar[2]" . It 
gives error saying it is not a valid xpath.

- R

----- Original Message ----
From: Michael Kay <mike(_at_)saxonica(_dot_)com>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Wednesday, March 7, 2007 1:52:51 PM
Subject: RE: [xsl] Key to select all same nodes(same @id) except current node

I need a clarification on child::category. Does it returns 
all child category elements of current element?

Yes.

If my structure is
<category>
    <list>
        <category>
        </category>
    </list
</category>

so will it return inner category element?

Yes, if the current element is "list".

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
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>
--~--






 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

--~------------------------------------------------------------------
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>
--~--