XSLT is a language that can be run in a number of ways (just like any
other language). If you want to run it from inside a browser, you can
indeed do that, but you are stuck with XSLT 1.0 for the near foreseeable
future.
However, browser based transformations are not easy and you have to know
quite a bit of what is going on under the hood which makes it far from
ideal for beginners (let alone the differences between browsers: subtle,
but important).
If you want to learn XSLT, I recommend downloading Saxon. Use Saxon.NET
if you want just a simple executable that you can run from within your
favorite Integrated Development Environment. If you use Eclipse as IDE,
I think it is more likely that Saxon for Java suites you better.
If for one reason or the other, you are stuck with using client side
transformations, you can create non-portable functions using
msxml:script. Search google for examples, but remember: it will only
work in IE and it is not a recommended practice (IE7 has parsing scripts
in XSLT off by default).
Cheers,
-- Abel Braaksma
Karanam(_dot_)Chowdary(_at_)iflexsolutions(_dot_)com wrote:
What shud I do I m not using saxon and I m not running in cmd prompt. I
hv just written XSL code in text file and saved it as .xsl and directly
opening XML in browser. I really donno wat processor it is. Shud I
install sum processor(s/w). SAXON? I m just cing the results in IE not
cmd prompt. If I download saxon as u suggested can I get the results in
browser? And how shud I run that?
-----Original Message-----
From: Abel Braaksma [mailto:abel(_dot_)online(_at_)xs4all(_dot_)nl]
Sent: Wednesday, September 12, 2007 12:30 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] xsl:function
I just completed your code bit and changed the obvious xsl:result error
into xsl:value-of. But that was not the error you got. I ran it, and it
put out "2".
<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://whatever" exclude-result-prefixes="my">
<xsl:function name="my:one">
<xsl:param name="a"/>
<xsl:param name="b"/>
<xsl:value-of select="$a+$b"/>
</xsl:function>
<xsl:template match="/">
<xsl:value-of select="my:one(1,1)"/>
</xsl:template>
</xsl:stylesheet>
What I think is that you accidentally ran an XSLT 2.0 stylesheet with an
XSLT 1.0 processor (which should already complain about the xsl:function
instruction, but perhaps first throws an error about the extension
functions not being known. Saxon for instance says there's no known java
function).
Cheers,
-- Abel Braaksma
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--