[NTG-context] xml attribute conditional

Jon Crump jjcrump at uw.edu
Tue Dec 13 00:48:28 CET 2011


All,

I have a conditional expression that checks to see if the current node
has any ancestor whose xml:id attribute matches a string

\xmldoifelse{#1}{ancestor::div[@xml:id='apr_engl']}

What I need is a test to see if the current node has any ancestor
whose xml:id attribute _contains_ a substring. Something like this:

\xmldoifelse{#1}{ancestor::div[ @xml:id contains('_engl')]}

trying this:
\xmldoifelse{#1}{ancestor::div[ contains(@xml:id, '_engl')]}

got me this error:
! LuaTeX error <    local expr = xml.expressions...>:3: bad argument
#1 to 'contains' (string expected, got nil)

any suggestions?

Jon


More information about the ntg-context mailing list