ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: How to get the last item from an XML node
Date: Tue, 22 Sep 2020 09:18:21 +0200	[thread overview]
Message-ID: <87FBC62F-57F8-4E9F-9B39-E5D1EAD13314@elvenkind.com> (raw)
In-Reply-To: <c21ff6d6-c2d4-fe9f-8f4a-d4893d3b8435@mailbox.org>



> On 21 Sep 2020, at 18:31, Denis Maier <denis.maier.lists@mailbox.org> wrote:
> 
> Hi
> 
> struggling again: Shouldn't the code below give me the last element under <tbody>? Right now \xmlfilter{#1}{/tr/last()/command(xml:table:tbody:tr)} gives me nothing...
> 
> (Use case is that I want to have a frame above the table and one bar below. So I think I should wrap the last line in the \startxtablefoot ...\stopxtablefoot, i.e., I need one command for the last element, and one for the rest (Or is there a better way?). What would be the everything but the last?
> 
> What am I missing?

You need to read some more on the "Expressions and filters” chapter of the xml manual, as it does not work quite the way you think. Here is a quick fix:

> 
> 
> \startxmlsetups xml:table:tbody
>     \xmlfilter{#1}{/tr/last()/command(xml:table:tbody:tr)}

\xmlfilter{#1}{/tr[position()==last()]/command(xml:table:tbody:tr)}

Best wishes,
Taco

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-09-22  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 16:31 Denis Maier
2020-09-22  7:18 ` Taco Hoekwater [this message]
2020-09-22  8:23   ` Denis Maier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87FBC62F-57F8-4E9F-9B39-E5D1EAD13314@elvenkind.com \
    --to=taco@elvenkind.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).