W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2011

[Bug 12951] New: Simple mapping operator

From: <bugzilla@jessica.w3.org>
Date: Tue, 14 Jun 2011 01:08:07 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-12951-523@http.www.w3.org/Bugs/Public/>

           Summary: Simple mapping operator
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XPath 3.0
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: evan@evanlenz.net
         QAContact: public-qt-comments@w3.org

Forgive my ignorance on whether or not this is already in the works, but I'd
like to commend the addition of a "simple mapping operator" to XPath, exactly
along the lines described here (whether "!" is chosen or something else):

The "/" operator is powerful but limited. Here's a real-world example:


The nesting of parentheses is a pain to both read and write. JavaScript
developers, among others, recognize this and that's largely why jQuery has
grown so popular, with its simple chaining mechanism.

I'd much rather be able to type something like this:

/html/head/script/@src ! concat('..',.)
                       ! resolve-uri(.,$invoked-module-uri)
                       ! unparsed-text(.)

In the meantime, I can resort to a jQuery-like library approach (that requires
5 more characters) and trades performance for expressivity:


declare function _:_($items as item()*) {
  for $item in $items return <item>{$item}</item>

But it would obviously be much better to add a simple mapping operator to the
language itself. See the above link for Michael Kay's simple description of the
semantics. Basically, it would behave like "/" except not be limited to node
sequences, and it would retain order and duplicate node references.

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 Tuesday, 14 June 2011 01:08:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:35 UTC