Commits

Ville Suoranta authored fe10e336528 Merge
Merge pull request #963 in CASA/casa from CAS-12431 to master

* commit 'bece3c156902e5bcbcf7baf773934aeaefb5f673': (129 commits) CAS-12431 minor formatting CAS-12431 eliminate tabs CAS-12431 eliminate tabs CAS-12431 eliminate tabs CAS-12431 eliminate tabs CAS-12431 eliminate tabs CAS-12431 eliminate tabs from visstat.xml CAS-12431 eliminate tabs from polcal.xml CAS-12431 eliminate tabs from plotprofilemap.xml CAS-12431 eliminate tabs from plotms.xml CAS-12431 eliminate tabs from visstat.xml CAS-12431 eliminate tabs from wvrgcal.xml CAS-12431 eliminate tabs from widebandpbcor.xml CAS-12431 eliminate tabs from vishead.xml CAS-12431 eliminate tabs from virtualconcat.xml CAS-12431 eliminate tabs from viewer.xml CAS-12431 eliminate tabs from uvsub.xml CAS-12431 complete removing tabs from uvmodelfit.xml CAS-12431 eliminate tabs from uvmodelfit.xml CAS-12431 eliminate tabs from uvmodelvit.xml ...

gcwrap/install/casa2pycli.xsl

Modified
45 45 # (and other) to treat casapy tasks as a special case.
46 46
47 47 def __init__(self) :
48 48 self.__bases__ = (</xsl:text><xsl:value-of select="@name"/><xsl:text>_cli_,)
49 49 self.__doc__ = self.__call__.__doc__</xsl:text>
50 50
51 51 self.parameters=<xsl:text>{</xsl:text><xsl:apply-templates select="aps:input" mode="quotes"/>}
52 52 <xsl:text disable-output-escaping="yes">
53 53
54 54 def result(self, key=None):
55 - #### and add any that have completed...
56 - return None
55 + #### and add any that have completed...
56 + return None
57 57
58 58 </xsl:text>
59 59 def __call__<xsl:text>(self, </xsl:text><xsl:apply-templates select="aps:input" mode="noquotes"/>):
60 60 <xsl:text>
61 61 """</xsl:text>
62 62 <xsl:apply-templates select="aps:shortdescription"></xsl:apply-templates>
63 63 <xsl:apply-templates select="aps:description"/>
64 64 <xsl:if test="aps:input">
65 65 <xsl:text>
66 - Arguments :
66 + Arguments :
67 67 </xsl:text>
68 68 </xsl:if>
69 69 <xsl:for-each select="aps:input">
70 - <xsl:for-each select="aps:param">
71 - <xsl:if test="not(@visibility) or @visibility!='hidden'">
72 - <xsl:choose>
73 - <xsl:when test="aps:description">
74 - <xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text>: </xsl:text><xsl:value-of select="aps:description" disable-output-escaping="yes"/>
75 - </xsl:when>
76 - <xsl:otherwise>
77 - <xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text>: </xsl:text><xsl:value-of select="aps:shortdescription" disable-output-escaping="yes"/>
78 - </xsl:otherwise>
79 - </xsl:choose>
80 - <xsl:text>
70 + <xsl:for-each select="aps:param">
71 + <xsl:if test="not(@visibility) or @visibility!='hidden'">
72 + <xsl:choose>
73 + <xsl:when test="aps:description">
74 + <xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text>: </xsl:text><xsl:value-of select="aps:description" disable-output-escaping="yes"/>
75 + </xsl:when>
76 + <xsl:otherwise>
77 + <xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text>: </xsl:text><xsl:value-of select="aps:shortdescription" disable-output-escaping="yes"/>
78 + </xsl:otherwise>
79 + </xsl:choose>
80 + <xsl:text>
81 81 </xsl:text>
82 -<xsl:text> Default Value: </xsl:text><xsl:value-of select="aps:value"/>
82 +<xsl:text> Default Value: </xsl:text><xsl:value-of select="aps:value"/>
83 83 <xsl:if test="aps:allowed">
84 - <xsl:text>
85 - Allowed Values:</xsl:text>
86 - <xsl:for-each select="aps:allowed/aps:value">
87 - <xsl:text>
88 - </xsl:text><xsl:value-of select="."/>
89 - </xsl:for-each>
84 + <xsl:text>
85 + Allowed Values:</xsl:text>
86 + <xsl:for-each select="aps:allowed/aps:value">
87 + <xsl:text>
88 + </xsl:text><xsl:value-of select="."/>
89 + </xsl:for-each>
90 90 </xsl:if>
91 91 <xsl:text>
92 92
93 93 </xsl:text>
94 94 </xsl:if>
95 - </xsl:for-each>
95 + </xsl:for-each>
96 96 </xsl:for-each>
97 97 <xsl:if test="aps:returns">
98 - <xsl:for-each select="aps:returns">
99 - <xsl:text> Returns: </xsl:text><xsl:value-of select="@type"/><xsl:text>
98 + <xsl:for-each select="aps:returns">
99 + <xsl:text> Returns: </xsl:text><xsl:value-of select="@type"/><xsl:text>
100 100 </xsl:text>
101 101 </xsl:for-each>
102 102 </xsl:if>
103 103 <xsl:text>
104 - Example :
104 + Example :
105 105 </xsl:text>
106 106 <xsl:apply-templates select="aps:example"/>
107 107 <xsl:text>
108 108 """</xsl:text>
109 109 <xsl:text disable-output-escaping="yes">
110 - if not hasattr(self, "__globals__") or self.__globals__ == None :
110 + if not hasattr(self, "__globals__") or self.__globals__ == None :
111 111 self.__globals__=stack_frame_find( )
112 - #casac = self.__globals__['casac']
113 - casalog = self.__globals__['casalog']
114 - casa = self.__globals__['casa']
115 - #casalog = casac.casac.logsink()
112 + #casac = self.__globals__['casac']
113 + casalog = self.__globals__['casalog']
114 + casa = self.__globals__['casa']
115 + #casalog = casac.casac.logsink()
116 116 self.__globals__['__last_task'] = '</xsl:text><xsl:value-of select="$taskname"/><xsl:text disable-output-escaping="yes">'
117 117 self.__globals__['taskname'] = '</xsl:text><xsl:value-of select="$taskname"/><xsl:text disable-output-escaping="yes">'
118 118 ###
119 119 self.__globals__['update_params'](func=self.__globals__['taskname'],printtext=False,ipython_globals=self.__globals__)
120 120 ###
121 121 ###
122 122 #Handle globals or user over-ride of arguments
123 123 #
124 124 if type(self.__call__.func_defaults) is NoneType:
125 125 function_signature_defaults={}
126 - else:
127 - function_signature_defaults=dict(zip(self.__call__.func_code.co_varnames[1:],self.__call__.func_defaults))
128 - useLocalDefaults = False
126 + else:
127 + function_signature_defaults=dict(zip(self.__call__.func_code.co_varnames[1:],self.__call__.func_defaults))
128 + useLocalDefaults = False
129 129
130 130 for item in function_signature_defaults.iteritems():
131 131 key,val = item
132 132 keyVal = eval(key)
133 133 if (keyVal == None):
134 134 #user hasn't set it - use global/default
135 135 pass
136 136 else:
137 137 #user has set it - use over-ride
138 - if (key != 'self') :
139 - useLocalDefaults = True
140 -
141 - myparams = {}
142 - if useLocalDefaults :
143 - for item in function_signature_defaults.iteritems():
144 - key,val = item
145 - keyVal = eval(key)
146 - exec('myparams[key] = keyVal')
147 - self.parameters[key] = keyVal
148 - if (keyVal == None):
149 - exec('myparams[key] = '+ key + ' = self.itsdefault(key)')
150 - keyVal = eval(key)
151 - if(type(keyVal) == dict) :
138 + if (key != 'self') :
139 + useLocalDefaults = True
140 +
141 + myparams = {}
142 + if useLocalDefaults :
143 + for item in function_signature_defaults.iteritems():
144 + key,val = item
145 + keyVal = eval(key)
146 + exec('myparams[key] = keyVal')
147 + self.parameters[key] = keyVal
148 + if (keyVal == None):
149 + exec('myparams[key] = '+ key + ' = self.itsdefault(key)')
150 + keyVal = eval(key)
151 + if(type(keyVal) == dict) :
152 152 if len(keyVal) > 0 :
153 - exec('myparams[key] = ' + key + ' = keyVal[len(keyVal)-1][\'value\']')
154 - else :
155 - exec('myparams[key] = ' + key + ' = {}')
153 + exec('myparams[key] = ' + key + ' = keyVal[len(keyVal)-1][\'value\']')
154 + else :
155 + exec('myparams[key] = ' + key + ' = {}')
156 156
157 157 else :
158 158 print ''
159 159
160 160 </xsl:text>
161 161 <xsl:for-each select="aps:input">
162 162 <xsl:apply-templates select="aps:param"/>
163 163 <xsl:for-each select="aps:param">
164 164 <xsl:choose>
165 165 <xsl:when test="lower-case(@type)='boolarray'">
170 170 </xsl:when>
171 171 <xsl:when test="lower-case(@type)='stringarray'">
172 172 if type(<xsl:value-of select="@name"/>)==str: <xsl:value-of select="@name"/>=[<xsl:value-of select="@name"/>]<xsl:text/>
173 173 </xsl:when>
174 174 <xsl:when test="lower-case(@type)='doublearray'">
175 175 if type(<xsl:value-of select="@name"/>)==float: <xsl:value-of select="@name"/>=[<xsl:value-of select="@name"/>]<xsl:text/>
176 176 </xsl:when>
177 177 </xsl:choose>
178 178 </xsl:for-each>
179 179
180 - result = None
180 + result = None
181 181
182 182 #
183 183 # The following is work around to avoid a bug with current python translation
184 184 #
185 185 mytmp = {}
186 186 <xsl:for-each select="aps:param">
187 187 <xsl:choose>
188 188
189 189 <xsl:when test="@units">
190 190 if type(<xsl:value-of select="@name"/>) == str :
191 191 mytmp[&apos;<xsl:value-of select="@name"/>&apos;] = casac.casac.qa.quantity(<xsl:value-of select="@name"/>)
192 192 else :
193 193 mytmp[&apos;<xsl:value-of select="@name"/>&apos;] = <xsl:value-of select="@name"/>
194 194 </xsl:when>
195 195 <xsl:otherwise>
196 196 mytmp[&apos;<xsl:value-of select="@name"/>&apos;] = <xsl:value-of select="@name"/>
197 197 </xsl:otherwise>
198 198 </xsl:choose>
199 199 </xsl:for-each>
200 200 <xsl:text disable-output-escaping="yes">
201 - pathname='file://' + casa['dirs']['xml'] + '/'
202 - trec = casac.casac.utils().torecord(pathname+</xsl:text>&apos;<xsl:value-of select="$taskname"></xsl:value-of><xsl:text disable-output-escaping="yes">.xml&apos;)
201 + pathname='file://' + casa['dirs']['xml'] + '/'
202 + trec = casac.casac.utils().torecord(pathname+</xsl:text>&apos;<xsl:value-of select="$taskname"></xsl:value-of><xsl:text disable-output-escaping="yes">.xml&apos;)
203 203 </xsl:text>
204 204
205 205 <xsl:text disable-output-escaping="yes">
206 206 casalog.origin(&apos;</xsl:text><xsl:value-of select="$taskname"/><xsl:text disable-output-escaping="yes">&apos;)
207 - try :
207 + try :
208 208 #if not trec.has_key(&apos;</xsl:text><xsl:value-of select="$taskname"/><xsl:text disable-output-escaping="yes">&apos;) or not casac.casac.utils().verify(mytmp, trec[&apos;</xsl:text><xsl:value-of select="$taskname"/><xsl:text disable-output-escaping="yes">&apos;]) :
209 - #return False
209 + #return False
210 210
211 211 casac.casac.utils().verify(mytmp, trec[&apos;</xsl:text><xsl:value-of select="$taskname"/><xsl:text disable-output-escaping="yes">&apos;], True)
212 212 scriptstr=['']
213 213 saveinputs = self.__globals__['saveinputs']
214 214
215 215 # Save .last file for this task execution. MPI servers don't write it (CASR-329).
216 216 from mpi4casa.MPIEnvironment import MPIEnvironment
217 217 do_full_logging = MPIEnvironment.is_mpi_disabled_or_client()
218 218 if type(self.__call__.func_defaults) is NoneType:
219 219 saveinputs=''
236 236 # Effective call to the task as defined in gcwrap/python/scripts/task_*
237 237 result = <xsl:value-of select="$taskname"/>(<xsl:call-template name="doargs2"/>)
238 238
239 239 if do_full_logging and casa['state']['telemetry-enabled']:
240 240 task_endtime = str(datetime.datetime.now())
241 241 casalog.poststat( 'Task ' + tname + ' complete. Start time: ' + task_starttime + ' End time: ' + task_endtime )
242 242 casalog.post('##### End Task: ' + tname + ' ' + spaces + ' #####'+
243 243 '\n##########################################')
244 244 </xsl:for-each>
245 245 <xsl:text disable-output-escaping="yes">
246 - except Exception, instance:
246 + except Exception, instance:
247 247 if(self.__globals__.has_key('__rethrow_casa_exceptions') and self.__globals__['__rethrow_casa_exceptions']) :
248 248 raise
249 249 else :
250 250 #print '**** Error **** ',instance
251 - tname = </xsl:text>'<xsl:value-of select="$taskname"/>'<xsl:text disable-output-escaping="yes">
251 + tname = </xsl:text>'<xsl:value-of select="$taskname"/>'<xsl:text disable-output-escaping="yes">
252 252 casalog.post('An error occurred running task '+tname+'.', 'ERROR')
253 253 pass
254 - casalog.origin('')
254 + casalog.origin('')
255 255 </xsl:text>
256 256 <xsl:for-each select="aps:output">
257 257 <xsl:call-template name="checkoutput"/>
258 258 </xsl:for-each>
259 259 <xsl:text disable-output-escaping="yes">
260 260 return result
261 261 #
262 262 #
263 263 #
264 264 # def paramgui(self, useGlobals=True, ipython_globals=None):
265 265 # """
266 266 # Opens a parameter GUI for this task. If useGlobals is true, then any relevant global parameter settings are used.
267 267 # """
268 268 # import paramgui
269 -# if not hasattr(self, "__globals__") or self.__globals__ == None :
269 +# if not hasattr(self, "__globals__") or self.__globals__ == None :
270 270 # self.__globals__=stack_frame_find( )
271 271 #
272 272 # if useGlobals:
273 -# if ipython_globals == None:
273 +# if ipython_globals == None:
274 274 # myf=self.__globals__
275 275 # else:
276 276 # myf=ipython_globals
277 277 #
278 278 # paramgui.setGlobals(myf)
279 279 # else:
280 280 # paramgui.setGlobals({})
281 281 #
282 282 # paramgui.runTask(&apos;</xsl:text><xsl:value-of select="$taskname"/><xsl:text disable-output-escaping="yes">&apos;, myf['_ip'])
283 283 # paramgui.setGlobals({})
284 284 #
285 285 #
286 286 #
287 287 #
288 288 def defaults(self, param=None, ipython_globals=None, paramvalue=None, subparam=None):
289 - if not hasattr(self, "__globals__") or self.__globals__ == None :
289 + if not hasattr(self, "__globals__") or self.__globals__ == None :
290 290 self.__globals__=stack_frame_find( )
291 291 if ipython_globals == None:
292 292 myf=self.__globals__
293 293 else:
294 294 myf=ipython_globals
295 295
296 296 a = odict()
297 297 </xsl:text>
298 298 <xsl:for-each select="aps:input">
299 299 <xsl:call-template name="setdefaults"/>
323 323 if(a[param][k].has_key('notvalue')):
324 324 valornotval='notvalue'
325 325 if((a[param][k][valornotval])==paramvalue):
326 326 retval=a[param][k].copy()
327 327 retval.pop(valornotval)
328 328 if(subparam != None):
329 329 if(retval.has_key(subparam)):
330 330 retval=retval[subparam]
331 331 else:
332 332 retval=self.itsdefault(subparam)
333 - else:
333 + else:
334 334 retval=self.itsdefault(subparam)
335 335 return retval
336 336
337 337
338 338 #
339 339 #
340 340 def check_params(self, param=None, value=None, ipython_globals=None):
341 341 if ipython_globals == None:
342 342 myf=self.__globals__
343 343 else:
365 365 except Exception, instance:
366 366 #ignore the exception and just return it unchecked
367 367 myf[param] = value
368 368 return value
369 369 #
370 370 #
371 371 def description(self, key=&apos;</xsl:text><xsl:value-of select="$taskname"/><xsl:text disable-output-escaping="yes">&apos;, subkey=None):
372 372 desc={&apos;</xsl:text><xsl:value-of select="$taskname"></xsl:value-of><xsl:text disable-output-escaping="yes">&apos;: &apos;</xsl:text><xsl:value-of select="$taskdescription"/><xsl:text disable-output-escaping="yes">&apos;,
373 373 </xsl:text>
374 374 <xsl:for-each select="aps:input">
375 - <xsl:call-template name="oneliners"/><xsl:text disable-output-escaping="yes">
375 + <xsl:call-template name="oneliners"/><xsl:text disable-output-escaping="yes">
376 376 }
377 377 </xsl:text>
378 378 <xsl:for-each select="aps:constraints">
379 379 <xsl:text disable-output-escaping="yes">
380 380 #
381 381 # Set subfields defaults if needed
382 382 #
383 383 </xsl:text>
384 384 <xsl:call-template name="oneliners2"></xsl:call-template>
385 385 </xsl:for-each>
393 393 a = {}
394 394 </xsl:text>
395 395 <xsl:for-each select="aps:input">
396 396 <xsl:call-template name="setdefaults3"/>
397 397 #a = sys._getframe(len(inspect.stack())-1).f_globals
398 398 <xsl:for-each select="aps:constraints">
399 399 <xsl:call-template name="setdefaults4"/>
400 400 </xsl:for-each>
401 401 <xsl:text>
402 402 if a.has_key(paramname) :
403 - return a[paramname]
403 + return a[paramname]
404 404 </xsl:text>
405 405 </xsl:for-each>
406 406
407 407
408 408 <xsl:value-of select="$taskname"/>_cli = <xsl:value-of select="$taskname"/>_cli_()
409 409 </xsl:template>
410 410
411 411 <xsl:template match="aps:input" mode="noquotes"> <xsl:call-template name="doargs"></xsl:call-template>
412 412 </xsl:template>
413 413 <xsl:template match="aps:input" mode="quotes"> <xsl:call-template name="doqargs"></xsl:call-template>
414 414 </xsl:template>
415 415 <xsl:template match="aps:shortdescription"><xsl:value-of select="."/></xsl:template>
416 416 <xsl:template match="aps:description"><xsl:text>
417 417
418 - Detailed Description:
418 + Detailed Description:
419 419 </xsl:text><xsl:value-of select="."/></xsl:template>
420 420 <xsl:template match="aps:example"><xsl:value-of select="replace(., '\\.*\{verbatim\}', '')" disable-output-escaping="yes"/></xsl:template>
421 421
422 422 <xsl:template name="checkoutput">
423 423 <xsl:choose>
424 - <xsl:when test="count(aps:param) &gt; 1">
425 - for arg in result :
426 - if not result.has_key(arg) :
427 - throw('Missing output value '+arg)
424 + <xsl:when test="count(aps:param) &gt; 1">
425 + for arg in result :
426 + if not result.has_key(arg) :
427 + throw('Missing output value '+arg)
428 428 </xsl:when>
429 429 </xsl:choose>
430 430 </xsl:template>
431 431
432 432 <xsl:template name="doargs">
433 - <xsl:for-each select="aps:param"><xsl:value-of select="@name"/>=None, </xsl:for-each>
433 + <xsl:for-each select="aps:param"><xsl:value-of select="@name"/>=None, </xsl:for-each>
434 434 </xsl:template>
435 435
436 436 <xsl:template name="doqargs">
437 - <xsl:for-each select="aps:param">&apos;<xsl:value-of select="@name"/>&apos;:None, </xsl:for-each>
437 + <xsl:for-each select="aps:param">&apos;<xsl:value-of select="@name"/>&apos;:None, </xsl:for-each>
438 438 </xsl:template>
439 439
440 440 <xsl:template name="doargs2">
441 441 <xsl:for-each select="aps:param"><xsl:value-of select="@name"/><xsl:if test="position()&lt;last()">, </xsl:if></xsl:for-each>
442 442 </xsl:template>
443 443
444 444 <xsl:template match="aps:param">
445 - <xsl:text> myparams[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = <xsl:value-of select="@name"/> = self.parameters[&apos;<xsl:value-of select="@name"/>&apos;]
445 + <xsl:text> myparams[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = <xsl:value-of select="@name"/> = self.parameters[&apos;<xsl:value-of select="@name"/>&apos;]
446 446 </xsl:template>
447 447
448 448 <xsl:template name="oneliners">
449 449 <xsl:for-each select="aps:param">
450 - <xsl:text disable-output-escaping="yes"> &apos;</xsl:text><xsl:value-of select="@name"></xsl:value-of><xsl:text disable-output-escaping="yes">&apos;: &apos;</xsl:text><xsl:choose><xsl:when test="aps:shortdescription"><xsl:value-of select="aps:shortdescription" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="aps:description" disable-output-escaping="yes"/></xsl:otherwise></xsl:choose><xsl:text disable-output-escaping="yes">&apos;,&#10;</xsl:text></xsl:for-each>
450 + <xsl:text disable-output-escaping="yes"> &apos;</xsl:text><xsl:value-of select="@name"></xsl:value-of><xsl:text disable-output-escaping="yes">&apos;: &apos;</xsl:text><xsl:choose><xsl:when test="aps:shortdescription"><xsl:value-of select="aps:shortdescription" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="aps:description" disable-output-escaping="yes"/></xsl:otherwise></xsl:choose><xsl:text disable-output-escaping="yes">&apos;,&#10;</xsl:text></xsl:for-each>
451 451 </xsl:template>
452 452
453 453 <xsl:template name="oneliners2">
454 454 <xsl:for-each select="aps:when">
455 455 <xsl:for-each select="aps:equals">
456 456 <xsl:call-template name="contextdesc">
457 457 <xsl:with-param name="paramname"><xsl:value-of select="@value"/></xsl:with-param>
458 458 </xsl:call-template>
459 459 </xsl:for-each>
460 460 </xsl:for-each>
486 486 <xsl:when test="lower-case(@type)='record'">
487 487 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = <xsl:call-template name="handlevalue"/><xsl:text>&#10;</xsl:text>
488 488 </xsl:when>
489 489 <xsl:when test="lower-case(@type)='string'">
490 490 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = &apos;<xsl:value-of select="aps:value"/>&apos;<xsl:text>&#10;</xsl:text>
491 491 </xsl:when>
492 492 <xsl:when test="lower-case(@type)='boolarray'">
493 493 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:value-of select="aps:value"/>]<xsl:text>&#10;</xsl:text>
494 494 </xsl:when>
495 495 <xsl:when test="lower-case(@type)='stringarray'">
496 - <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:apply-templates select="aps:value"><xsl:with-param name="arraytype"><xsl:value-of>string</xsl:value-of></xsl:with-param></xsl:apply-templates>]<xsl:text>&#10;</xsl:text>
496 + <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:apply-templates select="aps:value"><xsl:with-param name="arraytype"><xsl:value-of>string</xsl:value-of></xsl:with-param></xsl:apply-templates>]<xsl:text>&#10;</xsl:text>
497 497 </xsl:when>
498 498 <xsl:when test="lower-case(@type)='intarray'">
499 499 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:apply-templates select="aps:value"><xsl:with-param name="unitsare"><xsl:if test="@units"><xsl:value-of select="@units"/></xsl:if></xsl:with-param></xsl:apply-templates>]<xsl:text>&#10;</xsl:text>
500 500 </xsl:when>
501 501 <xsl:when test="lower-case(@type)='doublearray'">
502 502 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:apply-templates select="aps:value"><xsl:with-param name="unitsare"><xsl:if test="@units"><xsl:value-of select="@units"/></xsl:if></xsl:with-param></xsl:apply-templates>]<xsl:text>&#10;</xsl:text>
503 503 </xsl:when>
504 504 <xsl:otherwise>
505 505 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = <xsl:if test="@units!=''">&apos;</xsl:if><xsl:value-of select="aps:value"/><xsl:if test="@units!=''"><xsl:value-of select="@units"/>&apos;</xsl:if><xsl:text>&#10;</xsl:text>
506 506 </xsl:otherwise>
660 660 <xsl:when test="lower-case(@type)='record'">
661 661 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = <xsl:call-template name="handlevalue"/><xsl:text>&#10;</xsl:text>
662 662 </xsl:when>
663 663 <xsl:when test="lower-case(@type)='string'">
664 664 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = &apos;<xsl:value-of select="aps:value"/>&apos;<xsl:text>&#10;</xsl:text>
665 665 </xsl:when>
666 666 <xsl:when test="lower-case(@type)='boolarray'">
667 667 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:value-of select="aps:value"/>]<xsl:text>&#10;</xsl:text>
668 668 </xsl:when>
669 669 <xsl:when test="lower-case(@type)='stringarray'">
670 - <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:apply-templates select="aps:value"><xsl:with-param name="arraytype"><xsl:value-of>string</xsl:value-of></xsl:with-param></xsl:apply-templates>]<xsl:text>&#10;</xsl:text>
670 + <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:apply-templates select="aps:value"><xsl:with-param name="arraytype"><xsl:value-of>string</xsl:value-of></xsl:with-param></xsl:apply-templates>]<xsl:text>&#10;</xsl:text>
671 671 </xsl:when>
672 672 <xsl:when test="lower-case(@type)='intarray'">
673 673 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:apply-templates select="aps:value"><xsl:with-param name="unitsare"><xsl:if test="@units"><xsl:value-of select="@units"/></xsl:if></xsl:with-param></xsl:apply-templates>]<xsl:text>&#10;</xsl:text>
674 674 </xsl:when>
675 675 <xsl:when test="lower-case(@type)='doublearray'">
676 676 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = [<xsl:apply-templates select="aps:value"><xsl:with-param name="unitsare"><xsl:if test="@units"><xsl:value-of select="@units"/></xsl:if></xsl:with-param></xsl:apply-templates>]<xsl:text>&#10;</xsl:text>
677 677 </xsl:when>
678 678 <xsl:otherwise>
679 679 <xsl:text> a[&apos;</xsl:text><xsl:value-of select="@name"/>&apos;] = <xsl:if test="@units!=''">&apos;</xsl:if><xsl:value-of select="aps:value"/><xsl:if test="@units!=''"><xsl:value-of select="@units"/>&apos;</xsl:if><xsl:text>&#10;</xsl:text>
680 680 </xsl:otherwise>
750 750 </xsl:text>
751 751 </xsl:for-each>
752 752 </xsl:for-each>
753 753 </xsl:template>
754 754
755 755 <xsl:template match="aps:value">
756 756 <xsl:param name="unitsare"/>
757 757 <xsl:param name="arraytype"/>
758 758 <xsl:choose>
759 759 <xsl:when test="count(aps:value)">
760 - <xsl:for-each select="aps:value">
760 + <xsl:for-each select="aps:value">
761 761 <xsl:choose>
762 - <xsl:when test="$unitsare!=''">&apos;<xsl:value-of select="."/><xsl:value-of select="$unitsare"></xsl:value-of>&apos;<xsl:if test="position()&lt;last()">, </xsl:if></xsl:when>
763 - <xsl:when test="lower-case(@type)='string'">&apos;<xsl:value-of select="."/>&apos;<xsl:if test="position()&lt;last()">, </xsl:if></xsl:when>
764 - <xsl:otherwise><xsl:if test="$arraytype='string'">&apos;</xsl:if><xsl:value-of select="."/><xsl:if test="$arraytype='string'">&apos;</xsl:if><xsl:if test="position()&lt;last()">, </xsl:if></xsl:otherwise>
765 - </xsl:choose>
762 + <xsl:when test="$unitsare!=''">&apos;<xsl:value-of select="."/><xsl:value-of select="$unitsare"></xsl:value-of>&apos;<xsl:if test="position()&lt;last()">, </xsl:if></xsl:when>
763 + <xsl:when test="lower-case(@type)='string'">&apos;<xsl:value-of select="."/>&apos;<xsl:if test="position()&lt;last()">, </xsl:if></xsl:when>
764 + <xsl:otherwise><xsl:if test="$arraytype='string'">&apos;</xsl:if><xsl:value-of select="."/><xsl:if test="$arraytype='string'">&apos;</xsl:if><xsl:if test="position()&lt;last()">, </xsl:if></xsl:otherwise>
765 + </xsl:choose>
766 766 </xsl:for-each>
767 767 </xsl:when>
768 768 <xsl:otherwise><xsl:if test="$arraytype='string'">&apos;</xsl:if><xsl:value-of select="."/><xsl:if test="$arraytype='string'">&apos;</xsl:if><xsl:if test="position()&lt;last()">, </xsl:if>
769 769 </xsl:otherwise>
770 770 </xsl:choose>
771 771 </xsl:template>
772 772
773 773 <!-- templates go here -->
774 774 </xsl:stylesheet>

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut