Project

General

Profile

« Previous | Next » 

Revision 2556

xpath.py: get(): Create attrs: Put keys last so that any lookahead assertion's path will be created last as it would have without the assertion. This ensures that any value argument of an XML function will always go last even if a lookahead assertion would otherwise have caused it to be created with the element's keys, which previously were created before the attributes.

View differences:

inputs/MT/test/VegBIEN.specimens.xml.ref
21 21
                    </locationevent>
22 22
                </locationevent_id>
23 23
                <taxondetermination>
24
                    <role>identifier</role>
25 24
                    <isoriginal>true</isoriginal>
26 25
                    <iscurrent>true</iscurrent>
26
                    <role>identifier</role>
27 27
                    <plantconcept_id>
28 28
                        <plantconcept>
29 29
                            <plantname_id>
......
69 69
                    </locationevent>
70 70
                </locationevent_id>
71 71
                <taxondetermination>
72
                    <role>identifier</role>
73 72
                    <isoriginal>true</isoriginal>
74 73
                    <iscurrent>true</iscurrent>
74
                    <role>identifier</role>
75 75
                    <plantconcept_id>
76 76
                        <plantconcept>
77 77
                            <plantname_id>
inputs/XAL/test/VegBIEN.specimens.xml.ref
48 48
                    </locationevent>
49 49
                </locationevent_id>
50 50
                <taxondetermination>
51
                    <iscurrent>true</iscurrent>
51 52
                    <role>identifier</role>
52
                    <iscurrent>true</iscurrent>
53 53
                    <party_id>
54 54
                        <party>
55 55
                            <givenname>ND</givenname>
inputs/NY/test/VegBIEN.specimens.xml.ref
47 47
                    </locationevent>
48 48
                </locationevent_id>
49 49
                <taxondetermination>
50
                    <role>identifier</role>
51 50
                    <isoriginal>true</isoriginal>
52 51
                    <iscurrent>true</iscurrent>
52
                    <role>identifier</role>
53 53
                    <plantconcept_id>
54 54
                        <plantconcept>
55 55
                            <plantname_id>
......
148 148
                    </locationevent>
149 149
                </locationevent_id>
150 150
                <taxondetermination>
151
                    <role>identifier</role>
152 151
                    <isoriginal>true</isoriginal>
153 152
                    <iscurrent>true</iscurrent>
153
                    <role>identifier</role>
154 154
                    <plantconcept_id>
155 155
                        <plantconcept>
156 156
                            <plantname_id>
inputs/UNCC/test/VegBIEN.specimens.xml.ref
28 28
                    </locationevent>
29 29
                </locationevent_id>
30 30
                <taxondetermination>
31
                    <role>identifier</role>
32 31
                    <isoriginal>true</isoriginal>
33 32
                    <iscurrent>true</iscurrent>
33
                    <role>identifier</role>
34 34
                    <plantconcept_id>
35 35
                        <plantconcept>
36 36
                            <plantname_id>
......
77 77
                    </locationevent>
78 78
                </locationevent_id>
79 79
                <taxondetermination>
80
                    <role>identifier</role>
81 80
                    <isoriginal>true</isoriginal>
82 81
                    <iscurrent>true</iscurrent>
82
                    <role>identifier</role>
83 83
                    <plantconcept_id>
84 84
                        <plantconcept>
85 85
                            <plantname_id>
inputs/ACAD/test/VegBIEN.specimens.xml.ref
45 45
                    </locationevent>
46 46
                </locationevent_id>
47 47
                <taxondetermination>
48
                    <role>identifier</role>
49 48
                    <isoriginal>true</isoriginal>
50 49
                    <iscurrent>true</iscurrent>
50
                    <role>identifier</role>
51 51
                    <plantconcept_id>
52 52
                        <plantconcept>
53 53
                            <plantname_id>
......
167 167
                    </locationevent>
168 168
                </locationevent_id>
169 169
                <taxondetermination>
170
                    <role>identifier</role>
171 170
                    <isoriginal>true</isoriginal>
172 171
                    <iscurrent>true</iscurrent>
172
                    <role>identifier</role>
173 173
                    <plantconcept_id>
174 174
                        <plantconcept>
175 175
                            <plantname_id>
inputs/SALVIAS-CSV/test/VegBIEN.organisms.xml.ref
29 29
                    </voucher>
30 30
                    <growthform>tree</growthform>
31 31
                    <taxondetermination>
32
                        <iscurrent>true</iscurrent>
32 33
                        <role>computer</role>
33
                        <iscurrent>true</iscurrent>
34 34
                        <plantconcept_id>
35 35
                            <plantconcept>
36 36
                                <plantname_id>
......
55 55
                        </plantconcept_id>
56 56
                    </taxondetermination>
57 57
                    <taxondetermination>
58
                        <role>identifier</role>
59 58
                        <isoriginal>true</isoriginal>
60 59
                        <iscurrent>true</iscurrent>
60
                        <role>identifier</role>
61 61
                        <plantconcept_id>
62 62
                            <plantconcept>
63 63
                                <plantname_id>
......
131 131
                    </voucher>
132 132
                    <growthform>tree</growthform>
133 133
                    <taxondetermination>
134
                        <iscurrent>true</iscurrent>
134 135
                        <role>computer</role>
135
                        <iscurrent>true</iscurrent>
136 136
                        <plantconcept_id>
137 137
                            <plantconcept>
138 138
                                <plantname_id>
......
157 157
                        </plantconcept_id>
158 158
                    </taxondetermination>
159 159
                    <taxondetermination>
160
                        <role>identifier</role>
161 160
                        <isoriginal>true</isoriginal>
162 161
                        <iscurrent>true</iscurrent>
162
                        <role>identifier</role>
163 163
                        <plantconcept_id>
164 164
                            <plantconcept>
165 165
                                <plantname_id>
inputs/REMIB/test/VegBIEN.specimens.xml.ref
39 39
                    </locationevent>
40 40
                </locationevent_id>
41 41
                <taxondetermination>
42
                    <role>identifier</role>
43 42
                    <isoriginal>true</isoriginal>
44 43
                    <iscurrent>true</iscurrent>
44
                    <role>identifier</role>
45 45
                    <plantconcept_id>
46 46
                        <plantconcept>
47 47
                            <plantname_id>
......
111 111
                    </locationevent>
112 112
                </locationevent_id>
113 113
                <taxondetermination>
114
                    <role>identifier</role>
115 114
                    <isoriginal>true</isoriginal>
116 115
                    <iscurrent>true</iscurrent>
116
                    <role>identifier</role>
117 117
                    <plantconcept_id>
118 118
                        <plantconcept>
119 119
                            <plantname_id>
inputs/CTFS/test/VegBIEN.organisms.xml.ref
13 13
                        </locationevent>
14 14
                    </locationevent_id>
15 15
                    <taxondetermination>
16
                        <role>identifier</role>
17 16
                        <isoriginal>true</isoriginal>
18 17
                        <iscurrent>true</iscurrent>
18
                        <role>identifier</role>
19 19
                        <plantconcept_id>
20 20
                            <plantconcept>
21 21
                                <plantname_id>
......
69 69
                        </locationevent>
70 70
                    </locationevent_id>
71 71
                    <taxondetermination>
72
                        <role>identifier</role>
73 72
                        <isoriginal>true</isoriginal>
74 73
                        <iscurrent>true</iscurrent>
74
                        <role>identifier</role>
75 75
                        <plantconcept_id>
76 76
                            <plantconcept>
77 77
                                <plantname_id>
inputs/SALVIAS/test/VegBIEN.organisms.xml.ref
23 23
                    </specimenreplicate>
24 24
                    <growthform>tree</growthform>
25 25
                    <taxondetermination>
26
                        <iscurrent>true</iscurrent>
26 27
                        <role>computer</role>
27
                        <iscurrent>true</iscurrent>
28 28
                        <plantconcept_id>
29 29
                            <plantconcept>
30 30
                                <plantname_id>
......
55 55
                        </plantconcept_id>
56 56
                    </taxondetermination>
57 57
                    <taxondetermination>
58
                        <role>identifier</role>
59 58
                        <isoriginal>true</isoriginal>
60 59
                        <iscurrent>true</iscurrent>
60
                        <role>identifier</role>
61 61
                        <plantconcept_id>
62 62
                            <plantconcept>
63 63
                                <plantname_id>
......
114 114
                    </specimenreplicate>
115 115
                    <growthform>tree</growthform>
116 116
                    <taxondetermination>
117
                        <iscurrent>true</iscurrent>
117 118
                        <role>computer</role>
118
                        <iscurrent>true</iscurrent>
119 119
                        <plantconcept_id>
120 120
                            <plantconcept>
121 121
                                <plantname_id>
......
146 146
                        </plantconcept_id>
147 147
                    </taxondetermination>
148 148
                    <taxondetermination>
149
                        <role>identifier</role>
150 149
                        <isoriginal>true</isoriginal>
151 150
                        <iscurrent>true</iscurrent>
151
                        <role>identifier</role>
152 152
                        <plantconcept_id>
153 153
                            <plantconcept>
154 154
                                <plantname_id>
inputs/U/test/VegBIEN.specimens.xml.ref
90 90
                    </locationevent>
91 91
                </locationevent_id>
92 92
                <taxondetermination>
93
                    <role>identifier</role>
94 93
                    <isoriginal>true</isoriginal>
95 94
                    <iscurrent>true</iscurrent>
95
                    <role>identifier</role>
96 96
                    <plantconcept_id>
97 97
                        <plantconcept>
98 98
                            <plantname_id>
inputs/GBIF/test/VegBIEN.specimens.xml.ref
20 20
                    </locationevent>
21 21
                </locationevent_id>
22 22
                <taxondetermination>
23
                    <role>identifier</role>
24 23
                    <isoriginal>true</isoriginal>
25 24
                    <iscurrent>true</iscurrent>
25
                    <role>identifier</role>
26 26
                    <plantconcept_id>
27 27
                        <plantconcept>
28 28
                            <plantname_id>
......
85 85
                    </locationevent>
86 86
                </locationevent_id>
87 87
                <taxondetermination>
88
                    <role>identifier</role>
89 88
                    <isoriginal>true</isoriginal>
90 89
                    <iscurrent>true</iscurrent>
90
                    <role>identifier</role>
91 91
                    <plantconcept_id>
92 92
                        <plantconcept>
93 93
                            <plantname_id>
inputs/NCU-NCSC/test/VegBIEN.specimens.xml.ref
34 34
                    </locationevent>
35 35
                </locationevent_id>
36 36
                <taxondetermination>
37
                    <role>identifier</role>
38 37
                    <isoriginal>true</isoriginal>
39 38
                    <iscurrent>true</iscurrent>
39
                    <role>identifier</role>
40 40
                    <plantconcept_id>
41 41
                        <plantconcept>
42 42
                            <plantname_id>
......
97 97
                    </locationevent>
98 98
                </locationevent_id>
99 99
                <taxondetermination>
100
                    <role>identifier</role>
101 100
                    <isoriginal>true</isoriginal>
102 101
                    <iscurrent>true</iscurrent>
102
                    <role>identifier</role>
103 103
                    <plantconcept_id>
104 104
                        <plantconcept>
105 105
                            <plantname_id>
inputs/MO/test/VegBIEN.specimens.xml.ref
32 32
                    </locationevent>
33 33
                </locationevent_id>
34 34
                <taxondetermination>
35
                    <role>identifier</role>
36 35
                    <isoriginal>true</isoriginal>
37 36
                    <iscurrent>true</iscurrent>
37
                    <role>identifier</role>
38 38
                    <plantconcept_id>
39 39
                        <plantconcept>
40 40
                            <plantname_id>
......
121 121
                    </locationevent>
122 122
                </locationevent_id>
123 123
                <taxondetermination>
124
                    <role>identifier</role>
125 124
                    <isoriginal>true</isoriginal>
126 125
                    <iscurrent>true</iscurrent>
126
                    <role>identifier</role>
127 127
                    <plantconcept_id>
128 128
                        <plantconcept>
129 129
                            <plantname_id>
inputs/QMOR/test/VegBIEN.specimens.xml.ref
35 35
                    </locationevent>
36 36
                </locationevent_id>
37 37
                <taxondetermination>
38
                    <iscurrent>true</iscurrent>
38 39
                    <role>identifier</role>
39
                    <iscurrent>true</iscurrent>
40 40
                    <party_id>
41 41
                        <party>
42 42
                            <givenname>Robert,</givenname>
......
151 151
                    </locationevent>
152 152
                </locationevent_id>
153 153
                <taxondetermination>
154
                    <iscurrent>true</iscurrent>
154 155
                    <role>identifier</role>
155
                    <iscurrent>true</iscurrent>
156 156
                    <party_id>
157 157
                        <party>
158 158
                            <givenname>Robert,</givenname>
lib/xpath.py
288 288
    for node in nodes:
289 289
        # Create attrs
290 290
        if create:
291
            for attr in elem.keys + elem.attrs:
291
            # Keys last so that any lookahead assertion's path will be created
292
            # last as it would have without the assertion
293
            for attr in elem.attrs + elem.keys:
292 294
                get(node, attr, create, last_only=False, allow_rooted=False)
293 295
        
294 296
        # Follow pointer

Also available in: Unified diff