Apache Project Xalan XML/XSLT Processor Is Good, But Its Extension Not Work on Netscape/IE  
Author Message
RC





PostPosted: 2005-4-19 22:24:00 Top

java-programmer, Apache Project Xalan XML/XSLT Processor Is Good, But Its Extension Not Work on Netscape/IE First, let me say I couldn't find a group discuss
XML/XSLT. So I only choose the closest groups to
post this message.

Here is part of my *.xsl file

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:my-javascript-ext="my-ext1"
extension-element-prefixes="my-javascript-ext"
version="1.0">

<xalan:component prefix="my-javascript-ext" elements="whichever"
functions="hello">
<xalan:script lang="javascript">
function hello(w) {
return ("Hello " + w + "!");
}
</xalan:script>
</xalan:component>

....

<xsl:if test="function-available('my-javascript-ext:hello')">
<xsl:value-of select="my-javascript-ext:hello('World')" />
<br></br>
</xsl:if>
....


And this is part of my *.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<?xml-stylesheet type="text/xsl" href="http://myHostName/XML/myfile.xsl" ?>
....


This is working greate for an XML file iff (if only if) I type

java org.apache.xalan.xslt.Process -in myfile.xml -xsl myfile.xsl

or

java org.apache.xalan.xslt.Process -in myfile.xml


That is wonderful, when I set CLASSPATH with

/usr/local/xalan/bin/xalan.jar:/usr/local/xalan/bin/bsf.jar:/usr/local/xalan/bin/js.jar

So I can make my own extension to call my JavaScript functions and/or
Java Class methods inside a XSL file with XALAN Processor.
But unfortunaely this will NOT work on Netscape, Firefox, IE browsers,
even all these browser support XML/XSLT.

Anyone has some idea how should I make Apache Project XALAN's extension
work on a browser?

Thank Q!
 
Tony Marston





PostPosted: 2005-4-20 0:43:00 Top

java-programmer >> Apache Project Xalan XML/XSLT Processor Is Good, But Its Extension Not Work on Netscape/IE Try the XSL forum at http://www.tek-tips.com/

"RC" <email***@***.com> wrote in message
news:d434a4$ti0$email***@***.com...
> First, let me say I couldn't find a group discuss
> XML/XSLT. So I only choose the closest groups to
> post this message.
>
> Here is part of my *.xsl file
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xalan="http://xml.apache.org/xalan"
> xmlns:my-javascript-ext="my-ext1"
> extension-element-prefixes="my-javascript-ext"
> version="1.0">
>
> <xalan:component prefix="my-javascript-ext" elements="whichever"
> functions="hello">
> <xalan:script lang="javascript">
> function hello(w) {
> return ("Hello " + w + "!");
> }
> </xalan:script>
> </xalan:component>
>
> ....
>
> <xsl:if test="function-available('my-javascript-ext:hello')">
> <xsl:value-of select="my-javascript-ext:hello('World')" />
> <br></br>
> </xsl:if>
> ....
>
>
> And this is part of my *.xml file:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <?xml-stylesheet type="text/xsl" href="http://myHostName/XML/myfile.xsl"
> ?>
> ....
>
>
> This is working greate for an XML file iff (if only if) I type
>
> java org.apache.xalan.xslt.Process -in myfile.xml -xsl myfile.xsl
>
> or
>
> java org.apache.xalan.xslt.Process -in myfile.xml
>
>
> That is wonderful, when I set CLASSPATH with
>
> /usr/local/xalan/bin/xalan.jar:/usr/local/xalan/bin/bsf.jar:/usr/local/xalan/bin/js.jar
>
> So I can make my own extension to call my JavaScript functions and/or
> Java Class methods inside a XSL file with XALAN Processor.
> But unfortunaely this will NOT work on Netscape, Firefox, IE browsers,
> even all these browser support XML/XSLT.
>
> Anyone has some idea how should I make Apache Project XALAN's extension
> work on a browser?
>

The XALAN extension is for server-side transformations. Client-side
transformations are performed by the transformation engine which is built
into the individual browser. You CANNOT tell the browser to use a different
transformation engine.

--
Tony Marston

http://www.tonymarston.net



 
Disco Octopus





PostPosted: 2005-4-20 5:48:00 Top

java-programmer >> Apache Project Xalan XML/XSLT Processor Is Good, But Its Extension Not Work on Netscape/IE RC wrote :

> And this is part of my *.xml file:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <?xml-stylesheet type="text/xsl" href="http://myHostName/XML/myfile.xsl" ?>
> ....
>
>
> This is working greate for an XML file iff (if only if) I type
>
> java org.apache.xalan.xslt.Process -in myfile.xml -xsl myfile.xsl


The line...
<?xml-stylesheet type="text/xsl"
href="http://myHostName/XML/myfile.xsl" ?>
sould be....
<?xml:stylesheet type="text/xsl"
href="http://myHostName/XML/myfile.xsl" ?>

--
eat beef jerky

 
 
Johannes Koch





PostPosted: 2005-4-20 5:53:00 Top

java-programmer >> Apache Project Xalan XML/XSLT Processor Is Good, But Its Extension Not Work on Netscape/IE Disco Octopus wrote:
> The line...
> <?xml-stylesheet type="text/xsl"
> href="http://myHostName/XML/myfile.xsl" ?>
> sould be....
> <?xml:stylesheet type="text/xsl"
> href="http://myHostName/XML/myfile.xsl" ?>

Read <http://www.w3.org/TR/xml-stylesheet/>.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
 
 
Martin Honnen





PostPosted: 2005-4-20 21:01:00 Top

java-programmer >> Apache Project Xalan XML/XSLT Processor Is Good, But Its Extension Not Work on Netscape/IE

RC wrote:


> Here is part of my *.xsl file
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xalan="http://xml.apache.org/xalan"
> xmlns:my-javascript-ext="my-ext1"
> extension-element-prefixes="my-javascript-ext"
> version="1.0">
>
> <xalan:component prefix="my-javascript-ext" elements="whichever"
> functions="hello">
> <xalan:script lang="javascript">
> function hello(w) {
> return ("Hello " + w + "!");
> }
> </xalan:script>
> </xalan:component>
>
> ....
>
> <xsl:if test="function-available('my-javascript-ext:hello')">
> <xsl:value-of select="my-javascript-ext:hello('World')" />

> This is working greate for an XML file iff (if only if) I type
>
> java org.apache.xalan.xslt.Process -in myfile.xml -xsl myfile.xsl
>

> So I can make my own extension to call my JavaScript functions and/or
> Java Class methods inside a XSL file with XALAN Processor.
> But unfortunaely this will NOT work on Netscape, Firefox, IE browsers,
> even all these browser support XML/XSLT.
>
> Anyone has some idea how should I make Apache Project XALAN's extension
> work on a browser?

Use XSLT 1.0 without extensions if you want different XSLT processors to
be able to process your stylesheet and give you the desired result.
Using extension functions (written in Java or JavaScript) makes your
stylesheet incompatible.
Netscape/Firefox does not support extension functions in XSLT, neither
written in JavaScript nor in Java.
IE uses MSXML as the XSLT processor, that has support for extension
functions written in an Active Scripting language like JScript or
VBScript but don't expect the object model exposed to script to be the
same as with Xalan.

You have to decide what you want to achieve, if you think you need XSLT
with extension functions then you are usually bound to one certain XSLT
processor which you could for instance use on the server to do
transformations where the transformation result output is then sent to
the browsers so that those only have to deal with HTML.

If you want to use XSLT on different clients then you can't use
extensions, there is a project EXSLT (http://www.exslt.org/) but don't
expect support for that across browsers like Mozilla and IE and Safari.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
 
RC





PostPosted: 2005-4-21 1:48:00 Top

java-programmer >> Apache Project Xalan XML/XSLT Processor Is Good, But Its Extension Not Work on Netscape/IE Martin Honnen wrote:



> Netscape/Firefox does not support extension functions in XSLT, neither
> written in JavaScript nor in Java.
> IE uses MSXML as the XSLT processor, that has support for extension
> functions written in an Active Scripting language like JScript or
> VBScript but don't expect the object model exposed to script to be the
> same as with Xalan.

Remember last centure during 1990s, sometime you wrote a HTML page it
only can work in Netscape but not work in IE. Or work in IE but not work
in NS. We really don't wish the history repeat, BW2 (Brwoser War II).

I thought XML will end the browser war. But now seems to me a new
browser is starting from XSLT.
 
 
Martin Honnen





PostPosted: 2005-4-22 22:32:00 Top

java-programmer >> Apache Project Xalan XML/XSLT Processor Is Good, But Its Extension Not Work on Netscape/IE

RC wrote:

> Remember last centure during 1990s, sometime you wrote a HTML page it
> only can work in Netscape but not work in IE. Or work in IE but not work
> in NS. We really don't wish the history repeat, BW2 (Brwoser War II).
>
> I thought XML will end the browser war. But now seems to me a new
> browser is starting from XSLT.

If you want to use XSLT then it is best used on the server to transform
your XML to HTML that you send to the browsers. Client-side XSLT does
not have enough support, IE 6 has support for XSLT 1.0 (or IE 5/5.5 with
an updated MSXML installation), Mozilla has XSLT 1.0 support, I think
Safari since 1.3 has it too but other browsers not. And as I have
already said, if you want to use XSLT with different processors the
stick to the XSLT standard and do not use extensions.

--

Martin Honnen
http://JavaScript.FAQTs.com/