Project

General

Profile

« Previous | Next » 

Revision 7001

xml_func.py: _first(): Fixed bug where need to choose the first non-empty param, by first pruning empty child nodes

View differences:

inputs/CTFS/StemObservation/test.xml.ref
43 43
                                        </stemobservation>
44 44
                                    </plantobservation>
45 45
                                </aggregateoccurrence>
46
                                <authortaxoncode>
47
                                    <_alt>
48
                                        <0>$StemTag</0>
49
                                        <1>$Tag</1>
50
                                    </_alt>
51
                                </authortaxoncode>
46 52
                                <sourceaccessioncode>$MeasureID</sourceaccessioncode>
47 53
                                <taxondetermination>
48 54
                                    <taxonverbatim_id>
inputs/SALVIAS/plotObservations/test.xml.ref
117 117
                                        </stemobservation>
118 118
                                    </plantobservation>
119 119
                                </aggregateoccurrence>
120
                                <authortaxoncode>$Ind</authortaxoncode>
120 121
                                <collector_id>
121 122
                                    <party>
122 123
                                        <fullname>
inputs/SALVIAS-CSV/Organism/test.xml.ref
146 146
                                        </stemobservation>
147 147
                                    </plantobservation>
148 148
                                </aggregateoccurrence>
149
                                <authortaxoncode>$individual_code</authortaxoncode>
149 150
                                <collector_id>
150 151
                                    <party>
151 152
                                        <fullname>
inputs/CVS/taxonObservation_/test.xml.ref
18 18
                                        <stemobservation><sourceaccessioncode>$stemLocation_ID</sourceaccessioncode></stemobservation>
19 19
                                    </plantobservation>
20 20
                                </aggregateoccurrence>
21
                                <authortaxoncode>$authorPlantName</authortaxoncode>
21 22
                                <collector_id>
22 23
                                    <party>
23 24
                                        <fullname>
lib/xml_func.py
244 244
simplifying_funcs['_max'] = passthru
245 245

  
246 246
def _first(node):
247
    '''Chooses the first param (after sorting by numeric param name)'''
247
    '''Chooses the first non-empty param (sorting by numeric param name)'''
248
    xml_dom.prune_children(node)
248 249
    args = variadic_args(node)
249 250
    try: first = args[0]
250 251
    except IndexError: first = None

Also available in: Unified diff