(1) How does one retrieve an attribute from an element collected with \xmlindex{node{lpath}{n}? (2) I don't understand in xml:test \xmlcount{#1}{} giving 1 for an answer, whereas \xmlcount{#1}{*} and \xmlcount{#1}{/abc} yield 2 as is expected. (3) With the code below \xmlindex starts looping on an empty lpath, whereas like \xmltext{} react without problem. Problem is showed by \xmlindex, \xmlfirst, \xmllast, \xmlall, \xmlconcat Behaviour is not shown by \xmltext{node}{}, \xmlstripped, \xmlstrip Is this a bug in \xmlindex's underlying lua? ! TeX capacity exceeded, sorry [text input levels=127]. \xmlindex ...ua {lxml.index("#1","#2",\number #3)} \@@su:xml:test #1->test:\xmlindex {#1}{}{1} \par l.7 } \xmlindex ...ua {lxml.index("#1","#2",\number #3)} \@@su:xml:test #1->test:\xmlindex {#1}{}{1} \par \startxmlsetups xml:testsetups \xmlsetsetup{test}{test|abc}{xml:*} \stopxmlsetups \xmlregistersetup{xml:testsetups} \startxmlsetups xml:test test:\xmlindex{#1}{}{1}\par % << empty lpath fails \stopxmlsetups \startxmlsetups xml:abc abc:\xmlflush{#1}\par \stopxmlsetups \starttext \xmlprocessfile{test}{test.xml}{} \stoptext <test> <abc>ABC-1</abc> <abc>ABC-2</abc> </test> Hans van der Meer
On 15-3-2010 22:26, Hans van der Meer wrote:
(1) How does one retrieve an attribute from an element collected with \xmlindex{node{lpath}{n}?
(2) I don't understand in xml:test \xmlcount{#1}{} giving 1 for an answer, whereas \xmlcount{#1}{*} and \xmlcount{#1}{/abc} yield 2 as is expected.
because {} is not {*} but basically self
(3) With the code below \xmlindex starts looping on an empty lpath, whereas like \xmltext{} react without problem. Problem is showed by \xmlindex, \xmlfirst, \xmllast, \xmlall, \xmlconcat Behaviour is not shown by \xmltext{node}{}, \xmlstripped, \xmlstrip Is this a bug in \xmlindex's underlying lua?
! TeX capacity exceeded, sorry [text input levels=127]. \xmlindex ...ua {lxml.index("#1","#2",\number #3)} \@@su:xml:test #1->test:\xmlindex {#1}{}{1} \par l.7 } \xmlindex ...ua {lxml.index("#1","#2",\number #3)} \@@su:xml:test #1->test:\xmlindex {#1}{}{1} \par
\startxmlsetups xml:testsetups \xmlsetsetup{test}{test|abc}{xml:*} \stopxmlsetups \xmlregistersetup{xml:testsetups}
\startxmlsetups xml:test test:\xmlindex{#1}{}{1}\par % << empty lpath fails \stopxmlsetups
why do you use xmlindex in this case you could use \xmlfirst{#1} or \xmlfilter{#1}{[position()=1]} (I will probably rewrite xmlindex as it's a leftover) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Hans van der Meer