[XML-SIG] createProcessingInstruction

Derek Basch dbasch at yahoo.com
Wed Dec 15 23:28:56 CET 2004


Hello,

I am having problems with using the xml.dom.minidom.createProcessingInstruction
method to create an XSL Style Sheet reference. It places the XSL Style Sheet
reference at the end the generated XML instead of the beginning. This breaks
the transformation in Firefox v1. Has anyone run into this before? Thanks
everyone.

The generated XML:

<?xml version='1.0' encoding='UTF-8'?>
<receipt xmlns='http://172.20.0.70:81/receipt/'
received='2004-12-15T14:21:57.543603-08:00'>
  <transaction status='http://172.20.0.70:81/evaluator/smm/set1/status.xml'
uri='http://172.20.0.70:81/evaluator/smm/set1/status.xml'/>
</receipt>
<?xml-stylesheet type="text/xsl"
href="http://172.20.0.70:81/evaluator/receipt.xsl"?>

The python code:

def createReceipt(self):
	imp= xml.dom.minidom.getDOMImplementation()
	doctype = imp.createDocumentType("receipt", None, None)
	doc = imp.createDocument("http://172.20.0.70:81/receipt/", 'receipt', doctype)
	doc.appendChild(doc.createProcessingInstruction("xml-stylesheet",
"type=\"text/xsl\" href=\"http://172.20.0.70:81/evaluator/receipt.xsl\""))
	request_receipt_element = doc.documentElement
	transaction_element = doc.createElement("transaction")  
	request_receipt_element.setAttribute("received", "%s" %
(datetime.now(tz=TZ()).isoformat()))
	request_receipt_element.appendChild(transaction_element)    
	transaction_element.setAttribute("status", self.status_uri)
	transaction_element.setAttribute( "uri", self.set_directory_uri)
	
	return xml.dom.ext.PrettyPrint(doc)



		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 


More information about the XML-SIG mailing list