[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsk doubt [ ] vs ( )

Subject: Re: xsk doubt [ ] vs ( )
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 25 Apr 2002 10:57:42 +0100
xsk
Hi William,

> i have a basic doubt regarding conditions..
> what is the difference between saying
> <xsl:if test = "not[. = mytag/mytext]">

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:

  book[title = 'Genesis']

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:

  (a and b) or c

is different from:

  a and (b or c)

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:

  text()

is a shorthand for:

  child::text()

and collects all the text nodes that are children of the current node.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.