News for hackers. Stuff that matters.
Re:Htmlq: like jq, but for html by exyi on Tuesday September 07, 2021 @05:11AM (#28442622)
Thanks, this looks more powerfull. Support CSS, XPath and XQuery. Maybe I could learn a bit of XQuery when I have a use case for it :)
Re:Htmlq: like jq, but for html by dmit on Tuesday September 07, 2021 @07:46AM (#28443531)
Well, here’s your first lesson then: if you prepend (: to your comment it will become a valid XQuery document!

(: XQuery comments are marked by mirrored smilie faces, like this. :)

Re:Htmlq: like jq, but for html by benibela on Wednesday September 08, 2021 @11:12AM (#28458260)
Well, yes, but also no

An empty query is not valid. There needs to be something besides the comment

Re:Htmlq: like jq, but for html by bdcravens on Tuesday September 07, 2021 @03:39PM (#28448937)
Nice - I've been writing XQuery for years and I had no clue
Re:Htmlq: like jq, but for html by spiralx on Wednesday September 08, 2021 @04:47AM (#28454670)
Everything that isn't a (: happy comments :) is a FLWOR:

  <users>
  {
    for $user in //users
    let $comments = //comment[@uid = $user/@id]
    where count($comments) > 0
    order by $user/lastName, $user/firstName
    return <user id="{ $user/@id }">
      <name>{ concat($user.firstName, " ", $user.lastName) }</name>
      <comments count="count($comments)">
      {
        for $c in $comments return <comment id="{ $c/@id }" />
      }
      </comments>
    </user>
  }
  </users>
It's the bastard child of SQL and XPath 2 lol.

http://www.stylusstudio.com/xquery-flwor.html

Re:Htmlq: like jq, but for html by phlummox on Saturday September 11, 2021 @11:41PM (#28498451)
I kinda liked XQuery, but it seemed to never have got much traction.