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. Advertisements

  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. Advertisements

  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. Advertisements

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. asd
    Replies:
    3
    Views:
    629
    Arnaud Berger
    May 23, 2005
  2. gavnosis
    Replies:
    0
    Views:
    684
    gavnosis
    Aug 2, 2003
  3. Timo Nentwig

    selecting nodes between other nodes

    Timo Nentwig, Jun 16, 2004, in forum: XML
    Replies:
    1
    Views:
    560
    Patrick TJ McPhee
    Jun 17, 2004
  4. Johnny Ooi

    Looking A Nodes From Within Nodes

    Johnny Ooi, Nov 13, 2004, in forum: XML
    Replies:
    10
    Views:
    901
    Johnny Ooi
    Nov 14, 2004
  5. Replies:
    2
    Views:
    534
  6. Xamle Eng

    Why treat text nodes as nodes?

    Xamle Eng, May 13, 2005, in forum: XML
    Replies:
    8
    Views:
    680
    Fredrik Lundh
    May 28, 2005
  7. Replies:
    5
    Views:
    705
    bouton
    Sep 22, 2005
  8. th3dude
    Replies:
    0
    Views:
    580
    th3dude
    Jan 3, 2007
Loading...