Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this FAQ
XML itself provides a way to define the markup needed to implement scripting languages: as a neutral standard it neither encourages nor discourages their use, and does not favour one language over another, so it is possible to use XML markup to store the program code, from where it can be retrieved by (for example) XSLT and re-expressed in a HTML script element.
Server-side script embedding, like PHP or ASP, can be used with the relevant server to modify the XML code on the fly, as the document is served, just as they can with HTML. Authors should be aware, however, that embedding server-side scripting may mean the file as stored is not valid XML: it only becomes valid when processed and served, so care must be taken when using validating editors or other software to handle or manage such files. A better solution may be to use an XML serving solution like Cocoon.
If you need to embed scripts in a web page that you are generating from XML, you need to make sure that the two markup characters < and & are either escaped as < and & respectively, or that each script's content is enclosed in a CDATA Section so that it doesn't get seen as markup.