xslt queries in xml to SQL queries

Ian Roddis odd_raisin at REMOVEME.operamail.com
Sat Feb 25 19:45:41 EST 2006


Hello,

  I want to embed SQL type queries within an XML data record. The XML
looks something like this:
<DISPLAYPAGE>
	<FIELD NAME="SERVER" TYPE="DROPDOWN">
		<OPTION>1<OPTION>
		<OPTION>2<OPTION>
		<OPTION>3<OPTION>
	</FIELD>
</DISPLAYPAGE>

  I want to populate the drop down options from a database. The table
looks like this (example):
CREATE TABLE options_table (
	id		int primary key,
	name	varchar(255),
	field		varchar(255)
)


  I read an article that would allow me to embed an SQL query using XSLT
like this (in place of <OPTIONS>):
<xslt:template match="options_table[field='SERVER']">
	<OPTION><xslt:value-of select="name/text()"/></OPTION>
</xslt:template>
		
  Which would be equivalent of:

SELECT name FROM options_table WHERE field='SERVER';

  Does anyone else have experience of describing SQL queries in XML or
parsing XSLT in python?
-- 
To mail remove REMOVEME. from address.




More information about the Python-list mailing list