* xmlindex getting attributes and more
@ 2010-03-15 21:26 Hans van der Meer
2010-03-15 21:34 ` Hans Hagen
0 siblings, 1 reply; 2+ messages in thread
From: Hans van der Meer @ 2010-03-15 21:26 UTC (permalink / raw)
To: NTG ConTeXt
[-- Attachment #1.1: Type: text/plain, Size: 1311 bytes --]
(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
[-- Attachment #1.2: Type: text/html, Size: 4515 bytes --]
[-- Attachment #2: Type: text/plain, Size: 486 bytes --]
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: xmlindex getting attributes and more
2010-03-15 21:26 xmlindex getting attributes and more Hans van der Meer
@ 2010-03-15 21:34 ` Hans Hagen
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2010-03-15 21:34 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-15 21:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-15 21:26 xmlindex getting attributes and more Hans van der Meer
2010-03-15 21:34 ` Hans Hagen
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).