[NTG-context] xml attribute conditional

Jon Crump jjcrump at uw.edu
Tue Dec 13 20:21:37 CET 2011

Hans et alia,

Thanks for helping out with the right xpath expression. That was
indeed the problem: div elements in the ancestor axis that had no
xml:id attribute. Unfortunately, this doesn't solve my root problem.

I have a tei/xml marked up text with English and Arabic sections. For
each ref tag in the english section I want to place a \footnote. For
the corresponding ref in the Arabic section I want to place a \note
pointing to the same footnote as the corresponding English ref. The
minimal example appended below accomplishes this, but when I try to
apply this solution to my full text, this solution fails: I get ?? in
place of the references in the arabic, lua stats reports:

    mkiv lua stats  > cross referencing         - 56 identified, 56 unknown

and I get repeated errors of the following sort:

    xml             > lpath >          1 : ex :
@xml:id==string.sub('#N020-18', 2) ->
    (ll.at and ll.at['xml:id'])==string.sub('#N020-18', 2) ! Missing
number, treated as zero.

which is where, I presume, the ?? references are coming from

minimal example follows (\environment ara-sty not included)

Any insights you may have would be gratefully received.


(PS I suspect that the multiple errors associated with this problem
are what's causing --result renaming to fail)

xml input:
		<div type='arText'>
			<lb /> ين لنأخده <ref target="#N01"> للغاية تعيس </ref>
			<lb /> ين لنأخده <ref target="#N02"> شايلون شجوات </ref>
		<div type='enText'>
			<lb /> some english <ref target="#N01">referenced text</ref>
			<lb /> more english <ref target="#N02">referenced text</ref>
		<div type='fnotes'>
			<note xml:id="N01">text for note ONE</note>
			<note xml:id="N02">text for note TWO</note>

context environment:
\startxmlsetups xml:lbsetups
\environment ara-sty

\startxmlsetups xml:body

\startxmlsetups xml:text

\startxmlsetups xml:div:entext
	\setlatin{\switchtobodyfont[palatino,\Size] \xmlflush{#1}}

\startxmlsetups xml:div:artext
	\setarabic{\switchtobodyfont[Arabic] \xmlflush{#1}}

\startxmlsetups xml:div:fnotes

\startxmlsetups xml:ref

\startxmlsetups xml:note

the ref tag setup that fails for my larger text looks like this:

\startxmlsetups xml:ref
	\xmldoifelse{#1}{ancestor::div[@xml:id and contains(@xml:id,
'apr_engl')]} %% this expression works

			{\note[\xmlatt{#1}{target}]}{} %% argument to \note results in ??
instead of corresponding ref. number

More information about the ntg-context mailing list