This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: XPath 2.0: Conditional Expression (Was Re: XQuery 1.0 and XPath 2.0 Functions and Operators Version 1.0)


I'd second Jeni's request on this front, though I might also see keeping in
mind the node-set aspect. If you have a conditional statement of the form

if(myNodeSet=condition,exprA,exprB) then the function will return a node-set
containing either exprA or exprB depending upon whether the given node in
the node-set satisfies or fails to satisfy the condition.  Thus, if you have
a node-set of the form
<record name="Kurt"/>
<record name="Jeni"/>
<record name="Jim"/>

called $records and myFunc returns a node of the form
<invalidRecord name="myName"/>

if($records[@name="Jeni"], . , myFunc(//crossRef[@idref=./@name]))

would return a node-set of the form
<invalidRecord name="Kurt"/>
<record name="Jeni"/>
<invalidRecord name="Jim"/>

Of course, if no second condition is imposed, this just becomes a handy way
to apply a function to a bunch of nodes one a a time, since

function($nyNodeSet)
    would act on the node-set while
if($myNodeSet,function(.))
    would act on each node of the node-set.

The ability to convert a string to an XPath expression would be nice. It
sort of exists with the common node-set() extension in XSLT, but that to me
seems to be something that should be intrinsic to the functional set.

-- Kurt



----- Original Message -----
From: "Jeni Tennison" <mail@jenitennison.com>
To: "Jim Melton" <jim.melton@acm.org>
Cc: <xsl-list@lists.mulberrytech.com>
Sent: Friday, September 07, 2001 9:46 AM
Subject: XPath 2.0: Conditional Expression (Was Re: [xsl] XQuery 1.0 and
XPath 2.0 Functions and Operators Version 1.0)


> Hi Jim,
>
> Another XPath 2.0 requirement that doesn't seem to be present in the
> F&O WD is 2.2 "Must Provide a Conditional Expression". I imagined that
> conditional expressions would be supported with an operator, something
> like:
>
>   boolean-expression ? true-expression : false-expression
>
> Is this functionality going to appear in a different document?
>
> Cheers,
>
> Jeni
>
> ---
> Jeni Tennison
> http://www.jenitennison.com/
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]