xml-mkiv-lpath.tex /size: 6732 b    last modification: 2020-07-01 14:35
1\input lxml-ctx.mkiv
2
3\ctxlua{dofile("t:/sources/lxml-lpt.lua")}
4
5\startbuffer[xmltest]
6<?xml version='1.0'?>
7
8<!-- this is a test file -->
9
10<something id='1'>
11  <x:whatever id='1.1'>
12    <whocares id='1.1.1'>
13      test a
14    </whocares>
15    <whocaresnot id='1.1.2'>
16      test b
17    </whocaresnot>
18  </x:whatever>
19  <whatever id='2'>
20    <whocares id='2.1'>
21      test c
22    </whocares>
23    <whocaresnot id='2.2'>
24      test d
25    </whocaresnot>
26  </whatever>
27  <whatever id='3'>
28     test e
29  </whatever>
30  <whatever id='4' test="xxx">
31    <whocares id='4.1'>
32      test f
33    </whocares>
34    <whocares id='4.2'>
35      test g
36    </whocares>
37  </whatever>
38  <whatever id='5' test="xxx">
39    <whoknows id='5.1'>
40        <whocares id='5.1.1'>
41          test h
42        </whocares>
43    </whoknows>
44    <whoknows id='5.2'>
45        <whocaresnot id='5.2.1'>
46          test i
47        </whocaresnot>
48    </whoknows>
49    <whoknows id='5.3'>
50        <whocares id='5.3.1'>
51          test j
52        </whocares>
53    </whoknows>
54  </whatever>
55</something>
56\stopbuffer
57
58% \enabletrackers[xml.lparse]
59
60\setuplayout[width=middle,height=middle,header=1cm,footer=1cm,topspace=2cm,backspace=2cm]
61\setupbodyfont[10pt]
62
63\setfalse\xmllshowbuffer
64
65\starttext
66
67\xmllshow{/(*:library|figurelibrary)/*:figure/*:label}
68\xmllshow{/(*:library|figurelibrary)/figure/*:label}
69\xmllshow{/(*:library|figurelibrary)/figure/label}
70\xmllshow{/(*:library|figurelibrary)/figure:*/label}
71
72% \xmllshow{collection[@version='all']/resources/manual[match()==1]/paper/command(xml:overview)}
73% \xmllshow{collection/resources/manual[match()=1]/paper/command(xml:overview)}
74
75% \xmllshow{answer//oeps}
76% \xmllshow{answer/*/oeps}
77% \xmllshow{answer/**/oeps}
78% \xmllshow{answer/***/oeps}
79% \xmllshow{answer/x//oeps}
80% \xmllshow{answer//x/oeps}
81% \xmllshow{//x/oeps}
82% \xmllshow{answer/test/*}
83% \xmllshow{answer/test/child::}
84% \xmllshow{answer/*}
85% \xmllshow{  oeps / answer / .. / * [tag()='p' and position()=1 and text()!=''] / oeps()}
86
87% \xmllshow{ artist / name [text()='Randy Newman'] / .. / albums / album [position()=3] / command(first:demo:two)}
88% \xmllshow{/exa:selectors/exa:selector/exa:list/component[count()>1]}
89
90\stoptext
91
92\xmllshow{/*}
93\xmllshow{child::}
94\xmllshow{child::test}
95\xmllshow{/test/test}
96\xmllshow{../theory/sections/section/exercises}
97\xmllshow{../training/practicalassignments}
98\xmllshow{../../Outcome[position()=rootposition()]/Condition/command(xml:answer:mc:condition)}
99
100% \stoptext
101
102% \typebuffer[xmltest] \page
103
104\xmllshowbuffer{xmltest}{**}{id}
105\xmllshowbuffer{xmltest}{*}{id}
106\xmllshowbuffer{xmltest}{..}{id}
107\xmllshowbuffer{xmltest}{.}{id}
108\xmllshowbuffer{xmltest}{//}{id}
109\xmllshowbuffer{xmltest}{/}{id}
110
111\xmllshowbuffer{xmltest}{**/}{id}
112\xmllshowbuffer{xmltest}{**/*}{id}
113\xmllshowbuffer{xmltest}{**/.}{id}
114\xmllshowbuffer{xmltest}{**//}{id}
115
116\xmllshowbuffer{xmltest}{*/}{id}
117\xmllshowbuffer{xmltest}{*/*}{id}
118\xmllshowbuffer{xmltest}{*/.}{id}
119\xmllshowbuffer{xmltest}{*//}{id}
120
121\xmllshowbuffer{xmltest}{/**/}{id}
122\xmllshowbuffer{xmltest}{/**/*}{id}
123\xmllshowbuffer{xmltest}{/**/.}{id}
124\xmllshowbuffer{xmltest}{/**//}{id}
125
126\xmllshowbuffer{xmltest}{/*/}{id}
127\xmllshowbuffer{xmltest}{/*/*}{id}
128\xmllshowbuffer{xmltest}{/*/.}{id}
129\xmllshowbuffer{xmltest}{/*//}{id}
130
131\xmllshowbuffer{xmltest}{./}{id}
132\xmllshowbuffer{xmltest}{./*}{id}
133\xmllshowbuffer{xmltest}{./.}{id}
134\xmllshowbuffer{xmltest}{.//}{id}
135
136\xmllshowbuffer{xmltest}{../}{id}
137\xmllshowbuffer{xmltest}{../*}{id}
138\xmllshowbuffer{xmltest}{../.}{id}
139\xmllshowbuffer{xmltest}{..//}{id}
140
141\xmllshowbuffer{xmltest}{descendant::whocares/ancestor::whoknows}{id}
142\xmllshowbuffer{xmltest}{descendant::whocares/ancestor::whoknows/parent::}{id}
143\xmllshowbuffer{xmltest}{descendant::whocares/ancestor::}{id}
144\xmllshowbuffer{xmltest}{child::something/child::whatever/child::whocares}{id}
145\xmllshowbuffer{xmltest}{child::something/child::whatever/child::whocares|whoknows}{id}
146\xmllshowbuffer{xmltest}{child::something/child::whatever/child::(whocares|whoknows)}{id}
147\xmllshowbuffer{xmltest}{child::something/child::whatever/child::!(whocares|whoknows)}{id}
148\xmllshowbuffer{xmltest}{child::something/child::whatever/child::(whocares)}{id}
149\xmllshowbuffer{xmltest}{child::something/child::whatever/child::(whocares)[position()>2]}{id}
150\xmllshowbuffer{xmltest}{child::something/child::whatever[position()>2][position()=1]}{id}
151\xmllshowbuffer{xmltest}{child::something/child::whatever[whocares][whocaresnot]}{id}
152\xmllshowbuffer{xmltest}{child::something/child::whatever[whocares][not(whocaresnot)]}{id}
153\xmllshowbuffer{xmltest}{child::something/child::whatever/self::whatever}{id}
154\xmllshowbuffer{xmltest}{/something/whatever}{id}
155\xmllshowbuffer{xmltest}{something/whatever}{id}
156\xmllshowbuffer{xmltest}{/**/whocares}{id}
157\xmllshowbuffer{xmltest}{whoknows/whocares}{id}
158\xmllshowbuffer{xmltest}{whoknows}{id}
159\xmllshowbuffer{xmltest}{whocares[contains(text(),'f') or contains(text(),'g')]}{id}
160\xmllshowbuffer{xmltest}{whocares/first()}{id}
161\xmllshowbuffer{xmltest}{whocares/last()}{id}
162\xmllshowbuffer{xmltest}{whatever/all()}{id}
163\xmllshowbuffer{xmltest}{whocares/position(2)}{id}
164\xmllshowbuffer{xmltest}{whocares/position(-2)}{id}
165\xmllshowbuffer{xmltest}{whocares[1]}{id}
166\xmllshowbuffer{xmltest}{whocares[-1]}{id}
167\xmllshowbuffer{xmltest}{whocares[2]}{id}
168\xmllshowbuffer{xmltest}{whocares[-2]}{id}
169\xmllshowbuffer{xmltest}{whatever[3]/attribute(id)}{id}
170\xmllshowbuffer{xmltest}{whatever[2]/attribute('id')}{id}
171\xmllshowbuffer{xmltest}{whatever[3]/text()}{id}
172\xmllshowbuffer{xmltest}{/whocares/first()}{id}
173\xmllshowbuffer{xmltest}{/whocares/last()}{id}
174
175\xmllshowbuffer{xmltest}{xml://whatever/all()}{id}
176\xmllshowbuffer{xmltest}{whatever/all()}{id}
177\xmllshowbuffer{xmltest}{//whocares}{id}
178\xmllshowbuffer{xmltest}{..[2]}{id}
179\xmllshowbuffer{xmltest}{../*[2]}{id}
180
181\xmllshowbuffer{xmltest}{/(whocares|whocaresnot)}{id}
182\xmllshowbuffer{xmltest}{/!(whocares|whocaresnot)}{id}
183\xmllshowbuffer{xmltest}{/!whocares}{id}
184
185% \page
186
187% \xmllshow{/interface/command/command(xml:setups:register)}
188% \xmllshow{/interface/command[@name='xxx']/command(xml:setups:typeset)}
189% \xmllshow{/arguments/*}
190% \xmllshow{/sequence/first()}
191% \xmllshow{/arguments/text()}
192% \xmllshow{/sequence/variable/first()}
193% \xmllshow{/interface/define[@name='xxx']/first()}
194% \xmllshow{/parameter/command(xml:setups:parameter:measure)}
195
196% \page
197
198% \xmllshow{interface/command/command(xml:setups:register)}
199% \xmllshow{interface/command[@name='xxx']/command(xml:setups:typeset)}
200% \xmllshow{arguments/*}
201% \xmllshow{sequence/first()}
202% \xmllshow{arguments/text()}
203% \xmllshow{sequence/variable/first()}
204% \xmllshow{interface/define[@name='xxx']/first()}
205% \xmllshow{parameter/command(xml:setups:parameter:measure)}
206
207\stoptext
208