<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>


<!-- DANGER!!! THIS IS NOT SAFE AT ALL -->

<!-- SORRY FOR THIS HACK -->

<!-- eval() the js form returned by this stylesheet to insert
     the permits into the db -->

 <xsl:template match="/">

GearsDemo.db.execute('begin');
<xsl:for-each select='permits/permit'>
GearsDemo.db.execute('insert into permits (id,xml,outdated) values (<xsl:value-of select="id/."/>,'<xsl:copy-of select="."/>',0)');
</xsl:for-each>
GearsDemo.db.execute('commit');
 </template>

<!-- DANGER!!! THIS IS NOT SAFE AT ALL -->

</xsl:stylesheet>
