Somebody asked in Freenode the other day how to get their data out of MySQL into a specific XML format.
Both mysqldump and the mysql client have --xml options. The output from the cli looks like this:
<resultset statement="SELECT here">
<row>
<field name="field1">value</field>
<field name="field2">value</field>
</row>
<row>
<field name="field1">value</field>
<field name="field2">value</field>
</row>
</resultset>
I wanted to change those <field name=”fieldName”> into <fieldName> tags, and all it takes is a little XSLT, which I’ve uploaded here.
On Linux you can do something like this:
mysql -e "SELECT * FROM dbname.tablename" | xsltproc mysql.xsl -
PlanetMySQL Voting: Vote UP / Vote DOWN