|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Since xsl:script and xsl:eval are not recommended, so is t
Hi Collin, > Since xsl:script and xsl:eval are not recommended, so is there other > equavalent meahanism provided in XSL? I guess that by xsl:script and xsl:eval you're talking about the elements in WD-xsl? In WD-xsl, xsl:script is used to define functions using a scripting language. There's no standard way of doing this in XSLT 1.0, but most XSLT processors support something like it using an extension. In MSXML, for example, you can use msxsl:script in almost exactly the same way as you could use xsl:script. The major difference from WD-xsl is that all such functions have to be *extension* functions, which means that they have to be in a namespace. If you're using something other than MSXML, I recommend using func:function from EXSLT (http://www.exslt.org/func) to define the extension function using XSLT code rather than JavaScript, not least because there will be a built-in method for doing that (xsl:function) in XSLT 2.0. JavaScript is a very tempting get out for when you can't work out how to do something using XSLT, but it's more portable and better practice to use XSLT for the code. (Of course there are things that XSLT can't do, such as get the system time, or would require reams of code to support, such as regular expressions, but most of the time I see people using JavaScript in XSLT it's to do things that they could do using XSLT.) As far as xsl:eval is concerned, once you've declared an extension function, you can call it just like you can any other function. For example, rather than: <xsl:eval>myFunction()</xsl:eval> you should use: <xsl:value-of select="my:function()" /> If you have specific questions about XSLT, I heartily recommend the XSL-List -- http://www.mulberrytech.com/xsl/xsl-list -- as a place to ask them. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








