By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,180 Members | 1,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,180 IT Pros & Developers. It's quick & easy.

Finding nodes which hold for multiple conditions

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <bb**************************@posting.google.com >,
Ginu <gw****@yahoo.de> 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
Jul 20 '05 #2

P: n/a


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/
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.