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

Re: Conditional selecting

Subject: Re: Conditional selecting
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 13 Dec 2004 22:12:00 GMT
xml conditional type
> Because I have defined another template for the 'record' and I can't figure
> out a way to call it without loosing context of the calling template.  (I'm
> still very new to XSLT)

Using parameters with apply-templates is perfectly legal but rather
rare, so given no evidence to the contrary I'd suspect the last point
above to be the reason here:-) But it may be that you are doing
something where this is advisable, can't tell given the small snippet
posted. Still if it's working it's safe to ignore me and leave it be...

>> something like:
>>
>> select="$field_definitions/*[@type = 'EA0']
>>                             [plan_id or not(field_no=../*[@type =
>'EA0'][plan_id]/field_no)]
>>
>
>Yes, thank you!  Since I left my XSLT book at home today, could you please
>explain what this does?  I don't understand how the not statement works in
>this circumstance (I've used it in others though).
>

xpath is rather compositional, the meaning of an expression doesn't
normally depend on where that expression is used, so to understand a big
expression just start in the middle, and work out...

@type = 'EAO'
is a boolean test so it is true if any node in the node set selected by
@type is equal to 'EAO'. 

the next filter is of the same form:
 plan_id or not(field_no=../*[@type = 'EA0'][plan_id]/field_no)
is true if the node set selected by plan_id is true or if
  not(field_no=../*[@type = 'EA0'][plan_id]/field_no)
is true, which is true just if
 field_no=../*[@type = 'EA0'][plan_id]/field_no
is false.

this expression is true, if any node selected by filed_no is equal to
any node selected by ../*[@type = 'EA0'][plan_id]/field_no

this latter set is all the filed_no elements taht are children of the
siblings  (ie children of your parent, ../*) that have type='EAO' and
have a plan_id child.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.