471,066 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

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

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
2 13403

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

Similar topics

20 posts views Thread by Steven T. Hatton | last post: by
2 posts views Thread by hsharsha | last post: by
39 posts views Thread by utab | last post: by
5 posts views Thread by Niu Xiao | last post: by
7 posts views Thread by =?Utf-8?B?UGV0ZXI=?= | last post: by
9 posts views Thread by PengYu.UT | last post: by
4 posts views Thread by dolphin | last post: by
13 posts views Thread by bobby | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.