Jeni Tennison
> i have a basic doubt regarding conditions..
> what is the difference between saying
> <xsl:if test = "not[. = mytag/mytext]">
> and the same using ()
This is testing whether the 'not' child element of the current node
has a value that is equal to the value of (one of) its child 'mytag'
elements's child 'mytext' elements. > and saying
>
> <xsl:if test = "not(. = mytag/mytext)">
This is testing whether it's not the case that the value of the
current node is equal to the value of (one of) its child 'mytag'
elements's child 'mytext' elements. > when do we use the [ ] and when do we use ( )?? []s are predicates -- they are used to filter node sets according to
some condition. So for example: locates the book element child of the current node whose title element
child has the value 'Genesis'. ()s are used to wrap around expressions to indicate priority. So for
example: is different from:
Or, in the case that you've shown above, they're used after the name
of a function to hold the arguments for that function. not(), for
example, is a function that negates the boolean value of whatever's
passed as its argument.
()s are also used as part of node tests, so for example the
expression: is a shorthand for: and collects all the text nodes that are children of the current node. |