Subject: Re: [xsl] Conditional selecting From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 13 Dec 2004 22:12:00 GMT |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Conditional selecting, Jim Neff | Thread | RE: [xsl] Conditional selecting, Michael Kay |
Re: [xsl] Finding and restructuring, Daniel Koo | Date | [xsl] sum() function giving strange, Arun Sinha |
Month |