|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Hello and quick question
What's worse, the expression:
/ROOT/Client/Contacts/Contact[isReferrer='0'][1]/ContactFirstName will give results that are counterintuitive, since the [1] predicate operates not on the expression as a whole, but only on that particular step of that expression, "Contact[isReferrer='0'][1]" which (as all XSLT users certainly know!) is short for child::Contact[isReferrer='0'][position()=1] which means you'll get, not the first such Contact node in the document, but every Contact node (that meets the isReferrer criterion) *that is the first such child of its parent*. To get around this, you can say (/ROOT/Client/Contacts/Contact[isReferrer='0'])[1]/ContactFirstName (Grouping the entire expression indicates the predicate [1] applies to the expression as a whole.) But I actually rather like Corey's solution string(/ROOT/Client/Contacts/Contact[isReferrer='0']/ContactFirstName) ...although were I to use it in a stylesheet, I'd certainly explain it in a comment -- as something non-obvious that might be expected to break if, say, the rules of how node-sets are converted into strings should change.... Cheers, Wendell At 11:36 PM 1/6/2003, Joerg's wrote: Maybe you can better use some possible optimizations of the proceesor by adding [1] into the expression: ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








