Finding nodes which hold for multiple conditions

G

Ginu

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

Martin Honnen

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

Richard Tobin

Ginu said:
<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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top