Finding nodes which hold for multiple conditions

Discussion in 'XML' started by Ginu, Dec 14, 2004.

  1. Ginu

    Ginu Guest

    Hi,
    the task is to identify semantically identical elements where some
    additional attributes do not match.

    The XSL-transformation should find a node NAME which @id attribute
    matches to another NAME/@id in the document tree and additionally a
    specific further conditions holds (@cid's shouldn't be the same). For
    that I would like to refer to the node selected in the "following"
    axes, but I do not know how to refer to this "current-following" node.
    -------
    <xsl:if test="./NAME/@cid=following::NAME/@cid">

    and now I would liek to refer to the current and the selected
    following node for further checks like <!--[CURRENT@id !=
    CURRENTFOLLOWING-@id]" -->
    ....
    </xsl:if>
    --------
    Does anybody have an idea?
    Regards Ginu
    Ginu, Dec 14, 2004
    #1
    1. Advertising

  2. Ginu wrote:


    > The XSL-transformation should find a node NAME which @id attribute
    > matches to another NAME/@id in the document tree and additionally a
    > specific further conditions holds (@cid's shouldn't be the same). For
    > that I would like to refer to the node selected in the "following"
    > axes, but I do not know how to refer to this "current-following" node.
    > -------
    > <xsl:if test="./NAME/@cid=following::NAME/@cid">
    >
    > and now I would liek to refer to the current and the selected
    > following node for further checks like <!--[CURRENT@id !=
    > CURRENTFOLLOWING-@id]" -->


    I am not sure I understand what you want but there is the current()
    function in XSLT
    http://www.w3.org/TR/xslt#misc-func
    to find the current node so maybe that is what you are looking for.
    It can also help to use a variable e.g.
    <xsl:variable name="variableName" select="xpath expression here">
    to temporarily store a node or nodeset.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Dec 14, 2004
    #2
    1. Advertising

  3. In article <>,
    Ginu <> wrote:

    ><xsl:if test="./NAME/@cid=following::NAME/@cid">
    >
    >and now I would liek to refer to the current and the selected
    >following node for further checks like <!--[CURRENT@id !=
    >CURRENTFOLLOWING-@id]" -->


    If I understand you correctly, you can put a predicate on the
    following::NAME node that compares its id attribute with current()'s.

    <xsl:if test="./NAME/@cid=following::NAME[@id != current()/@id]/@cid">

    -- Richard
    Richard Tobin, Dec 14, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralph
    Replies:
    0
    Views:
    453
    Ralph
    May 20, 2004
  2. asd
    Replies:
    3
    Views:
    437
    Arnaud Berger
    May 23, 2005
  3. Replies:
    2
    Views:
    393
  4. th3dude
    Replies:
    0
    Views:
    433
    th3dude
    Jan 3, 2007
  5. Replies:
    3
    Views:
    374
    Tomás
    May 15, 2006
Loading...

Share This Page