ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \xmlrefatt as node?
@ 2021-07-19 14:27 Pablo Rodriguez
  0 siblings, 0 replies; only message in thread
From: Pablo Rodriguez @ 2021-07-19 14:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-19 14:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 14:27 \xmlrefatt as node? Pablo Rodriguez

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).