Subject: RE: [xsl] Using scripts with XML From: "Dion Houston" <dionh@xxxxxxxxxxxxxxxxxxxxx> Date: Tue, 12 Nov 2002 23:02:00 -0800 |
Well, this actually brings up a few interesting questions... 1. What do you mean exactly by "directly with XML"? XML files are documents that are marked up according to some explicit rules. Tags do not have any particular "meaning" associated with them, except that given to the particular XML application. Therefore asking if script can be "used" with XML, technically can only mean can script be encoded following the rules of XML. The answer to that is absolutely. E.g. <Foo><![CDATA[ var foo = 1; if (foo==1) ... ]]> </Foo> 2. More likely, you're curious if there is an XML parser which will somehow execute script you specify in an XML file automatically. The answer to that is: I know of no parser which will take an arbitrary XML document and run script contained in it. Some parsers may have the ability to run an inline stylesheet (MSXML does not, hence IE won't help). SVG can contain Jscript, but of course requires an SVG compatible browser or plugin. 3. MSXML and System.Xml (among others I'm sure) can run script contained in an XSLT stylesheet... The syntax is: <xsl:stylesheet ... xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="myURI"> ... <msxsl:script language="jscript" implements-prefix="user"> ... script here ... </msxsl:script> </xsl:stylesheet> 4. What exactly do you want to do? Thanks! Dion -----Original Message----- From: Michael Hall [mailto:ninti@xxxxxxxxx] Sent: Tuesday, November 12, 2002 9:42 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Using scripts with XML Quoting Chitra Lalita Madhwacharyula <iscp1059@xxxxxxxxxx>: > Hello, > > Is it possible to use any scripting language like Javascript or > ECMAScript directly with XML like they can be used with HTML or is > XSLT compulsarily needed for using the scripts ? AFAIK, it is not possible to use JavaScript/ECMAScript inside either XML or XSL files. But you could convert XML to HTML with Javascript, using XSL. XML files can be used without XSL, it depends on what you are doing. XML can be used with CSS to render simple pages in a web browser. If you want to actually change the XML into, say, HTML, then you will need to use XSL. XML and XSL can both be written dynamically using a scripting language like PHP, Python or Perl. Mick > > Rgds, > Chitra > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > -- ---------------------------------------------------- MICHAEL HALL Web Development Officer Batchelor Institute of Indigenous Tertiary Education W: mick.hall@xxxxxxxxx (08) 8951 8352 H: ninti@xxxxxxxxx (08) 8953 1442 ---------------------------------------------------- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using scripts with XML, Michael Hall | Thread | [xsl] Navigation using XPath, Chitra Lalita Madhwa |
Re: [xsl] Using scripts with XML, Michael Hall | Date | [xsl] Navigation using XPath, Chitra Lalita Madhwa |
Month |