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

What does <xsl:if test="not($values[. = $value])"> mean?

P: n/a
Hi,
What does <xsl:if test="not($values[. = $value])"mean? What I do
not understand is $values[. = $value]? Here, [] means array? And . =
$value means current node is equal to the variable value? So the total
meaning is "if not exists of value in array of values" ? But the result
of '. = $value' is a boolean value, so '$values[. = $value]' should not
mean "the value in values".

Rice

Oct 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

ri*****@gmail.com wrote:
What does <xsl:if test="not($values[. = $value])"mean?
Assuming that $values is a node-set (and what else could it
be if we're applying a predicate to it?), this means 'if
there are no nodes in the $values node-set such that the
text content of the node equals the $value', I believe.
What I do not understand is $values[. = $value]? Here, []
means array?
Of course not. There are no arrays in XSLT, [] is a
predicate.
And . = $value means current node is equal to the
variable value?
If by 'current node' you mean 'the node that we are testing
against the predicate', then, yes, that's what it means.
You should also remember that using a node in comparison
implicitly applies the XPath string() function to it. If
you want to compare the node identities you should
explicitly use the generate-id() function.

--
Pavel Lepin

Oct 18 '06 #2

P: n/a
ri*****@gmail.com wrote:
What does <xsl:if test="not($values[. = $value])"mean?
You would have better shown how the variable $values and the variable
$value is initialized. Assuming $values is initialized with a node set then
$values[. = $value]
selects those nodes in the node set for that the predicate in the square
brackets holds (i.e. . = $value).
So the result of
$values[. = $value]
is a node set again that can be empty or can contain one or more nodes.
Doing not() on a node set yields true if the node set is empty and false
otherwise so the test
<xsl:if test="not($values[. = $value])">
checks whether there are no nodes in $values for which the predicate holds.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.