- From: <bugzilla@wiggum.w3.org>
- Date: Thu, 21 Jan 2010 05:48:32 +0000
- To: public-qt-comments@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=8791 Summary: [XPath21] Allowing intermediate XPath steps to return atomic values Product: XPath / XQuery / XSLT Version: Working drafts Platform: All URL: http://www.w3.org/TR/2009/WD-xpath-21-20091215/ OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: XPath 2.1 AssignedTo: jonathan.robie@redhat.com ReportedBy: gandhi.mukul@gmail.com QAContact: public-qt-comments@w3.org Hi all, The following XPath (2.0) expression would raise an error, because the 2nd step in the expression, returns an atomic value: [1] product/substring(name,1,30)/replace(.,' ','-') This happens because, the XPath 2.0 language (and also the XPath 2.1 draft I believe -- which I'm not sure; please correct me if I am wrong) only allows the last step of an XPath expression, to return atomic values. I think, it would be nice to allow a XPath syntax something like below: product/substring(name,1,30)/replace($value,' ','-') The implicit variable reference, $value would only work if the previous XPath step is a sequence of atomic values (0-n in no's). Each call to replace function, would get an atomic value (the first argument) from the previous step. If the XPath step doesn't return an atomic value (which means, it returns node(s)), then $value will be empty sequence. This enhancement to XPath syntax would easy writing of some of complex XPath expressions. For e.g, the expression [1] (which is currently, disallowed) above currently might be accomplised like following: product/(for $n in name return replace(substring($n,1,30),' ','-')) Regards, Mukul -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug.
Received on Thursday, 21 January 2010 05:48:33 UTC