ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez <oinos@gmx.es>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: \xmlrefatt as node?
Date: Mon, 19 Jul 2021 16:27:19 +0200	[thread overview]
Message-ID: <cb6ee7a8-8277-8d87-8a0e-75a0d1628be3@gmx.es> (raw)

Dear list,

I have the following sample:

  \startbuffer[test]
  <document>
    <div id="section-i17a" class="section level1 hidden">
     <p id="par-i17"><a href="par-i17">1</a></p>
    </div>
    <div id="section-i18a" class="section level1 hidden">
     <p id="par-i18"><a href="par-i17">2</a></p>
    </div>
    <div id="section-i19a" class="section level1 hidden">
     <p id="par-i19"><a href="par-i17">3</a></p>
    </div>
  </document>
  \stopbuffer

  \startxmlsetups xml:testsetups
           \xmlsetsetup{#1}{*}{-}
      \xmlsetsetup{#1}{document|div|p|a}{xml:flushing}
      \xmlsetsetup{#1}{a}{xml:*}
  \stopxmlsetups

  \xmlregistersetup{xml:testsetups}

  \startxmlsetups xml:flushing
      \xmlflush{#1}
  \stopxmlsetups

  \startxmlsetups xml:a
  \xmlattribute{#1}{ancestor::div[@class='section level1 hidden']}{id}\\
  \xmlrefatt{#1}{href}:\
  \doifelse
    {\xmlrefatt{#1}{href}}
    {\xmlattribute{#1}{ancestor::div[@class='section level1 hidden']}{id}}
      {yes}{no}\blank
  \stopxmlsetups

  \starttext
      \xmlprocessbuffer{main}{test}{}
  \stoptext

I need to check whether the link is inside the same div or not.

I know how to obtain the destination identifier (\xmlreffatt{#1}{href}
and I know how to obtain the identifier of the contaning div
(\xmlattribute{#1}{ancestor::div[@class='section level1 hidden']}{id}}).

But I don’t know how to ge the identifier of the div which contains the
destination idetifier.

How could I get that?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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:[~2021-07-19 14:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=cb6ee7a8-8277-8d87-8a0e-75a0d1628be3@gmx.es \
    --to=oinos@gmx.es \
    --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).