Revision [1369]

This is an old revision of Lists made by DavePawson on 2010-05-10 02:20:57.

 

Plain lists


These are lists of items which might be strings for instance. Created with the '(' ... ')' notation. For example
ls=(a b c)

or to access the command line parameters from a script, as, say 'xmlsh scriptname a.xml b.xml c.xml

parms=$@
for f in $parms
do
  echo $f
done

which will produce
a.xml
b.xml
c.xml 
on stdout



To retain the list nature of a command output, use the form ($var) e.g.

lst=$(ls)
for file in $lst
do
  echo $file
done


xml items


To form a 'list' of xml items, use the notation '<[item, item, item]>'
But note that the contents of the list can be any type valid for xml, including content from the current context, e.g.
ls=<[a, "b", //x[3]]>

which adds the content of element a (from the current context), a string "b" and the third x element from the root context.

Note the difference between the two types of list and use the appropriate form

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki