I have this query that returns the_geom as text. However how could I also apply a transform to the same query. I can do this separately with the second example. Though I would like to do this to all the rows in my table, and in that example I copied the st_astext output into the transform query.

select  sitename,  st_astext(the_geom) from sites_tbl;                                 

sitename   |                st_astext

Belfast A    | POINT(145592 530021)

ST_AsText(ST_Transform(ST_SetSRID('POINT(145592 530021)'::geometry,27700), 4326));


Question: Carving elements from XML (xmlstarlet,awk,perl..)
Answer: You just have your xpath wrong:

xmlstarlet sel -t -c '//node' 


Also, valid XML required all attribute values to be quoted

&lt;document&gt;
&lt;nodes&gt;
&lt;node id="123"&gt;pages of txt&lt;/node&gt;
&lt;node id="124"&gt;more example pages of txt and sub elements&lt;/node&gt;
&lt;/nodes&gt;&lt;/document&gt; 


I've found this page gives lots of useful xpath examples: http://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx