The Artima Developer Community
Sponsored Link

Weblogs Forum
XSLT: The Other Programming Language in your Browser

9 replies on 1 page. Most recent reply: Nov 25, 2005 2:38 AM by Andy Dent

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 9 replies on 1 page
Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

XSLT: The Other Programming Language in your Browser (View in Weblogs)
Posted: Oct 30, 2005 11:16 AM
Reply to this message Reply
Summary
Most web-browsers today come with EcmaScript ( ie. JavaScript) built-in. Did you know another very powerful language came with Internet Explorer and Firefox?
Advertisement
XSLT is a surpringly powerful and criminally overlooked declarative programming language which comes standard with the latest versions Internet Exploer and Firefox, with extensions available for other browsers.

I, like many others, dismissed XSLT as being simply another stylesheet notation, but it is actually a full featured declarative language. It took me a fair amount of time to get the hang of using XSLT as a programming language, but my gosh is it ever powerful! Believe it or not I am currently building a JavaScript to C++ translator using XSLT, and it is progressing very well.

If you are interested in exploring the possibilities of XSLT, I recommend checking out:

  1. W3schools XSLT Tutorial
  2. Bob DuCharme's column at XML.com
  3. W3C XSLT Specification
  4. Mulberry Tech XSLT Mailing List


Swaroop C H

Posts: 10
Nickname: g2swaroop
Registered: Jan, 2004

Re: XSLT: The Other Programming Language in your Browser Posted: Oct 30, 2005 1:18 PM
Reply to this message Reply
"JavaScript to C++ translator using XSLT"

Interesting. Why JavaScript to C++? What are you trying to solve?

Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Re: XSLT: The Other Programming Language in your Browser Posted: Oct 30, 2005 1:43 PM
Reply to this message Reply
> "JavaScript to C++ translator using XSLT"
>
> Interesting. Why JavaScript to C++? What are you trying to
> solve?

I am actually trying to solve the problem of X <-> Y translation for a significant set of programming languages by using only XSLT documents. I picked JavaScript to C++ out of the sky, just like that, as a kind of a proof of concept. Once I get it done, I will look into doing others.

Calvin Mathew Spealman

Posts: 13
Nickname: ironfroggy
Registered: Aug, 2005

Re: XSLT: The Other Programming Language in your Browser Posted: Oct 30, 2005 4:32 PM
Reply to this message Reply
Might some intermediary language or format be best, and to write XSLTs to transform to and from each language and that?

Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Re: XSLT: The Other Programming Language in your Browser Posted: Oct 30, 2005 4:58 PM
Reply to this message Reply
> Might some intermediary language or format be best, and to
> write XSLTs to transform to and from each language and
> that?

Yes, I believe you are correct, and that is what I am trying to do. I am targetting an XML format as an intermediate format which represents an AST (Abstract Syntax Tree) as generally as possible. This format, which is not yet fully specified, I'm calling ASTXML for the time being.

Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Re: XSLT: The Other Programming Language in your Browser Posted: Oct 30, 2005 5:33 PM
Reply to this message Reply
> Might some intermediary language or format be best, and to
> write XSLTs to transform to and from each language and
> that?

There is a premature example of what the AST might look like at http://www.cdiggins.com/js-pass2-demo.xml. If you have IE 6 you should see the transformed output, take a look at the source to see from what it is transformed. The XSLT document is at: http://www.cdiggins.com/js-pass2.xslt. There is of course, the first pass documents http://www.cdiggins.com/js-pass1-demo.xml and http://www.cdiggins.com/js-pass1.xslt, and the original JavaScript tokenizer at http://www.cdiggins.com/tokenizer.html.

I think this technology has a lot of potential. I've only just begun to muck around with XSLT, and already I've got some pretty impressive transformations occuring.

Steven E. Newton

Posts: 137
Nickname: cm
Registered: Apr, 2003

Re: XSLT: The Other Programming Language in your Browser Posted: Oct 30, 2005 8:42 PM
Reply to this message Reply
You might be surprised to know that XSLT is fully turing-complete functional language.. http://www.topxml.com/xsl/articles/fp/

Michael Feathers

Posts: 448
Nickname: mfeathers
Registered: Jul, 2003

Re: XSLT: The Other Programming Language in your Browser Posted: Oct 31, 2005 9:55 AM
Reply to this message Reply
> You might be surprised to know that XSLT is fully
> turing-complete functional language..
> http://www.topxml.com/xsl/articles/fp/

Yes, it is. Sometimes I think there should be vote to decide which is the world's most ungainly system to use as a functional programming language: XSLT or the C++ template instantiation engine. :) It seemed that they both wandered into FP-hood accidently.

Gregor Zeitlinger

Posts: 108
Nickname: gregor
Registered: Aug, 2005

Re: XSLT: The Other Programming Language in your Browser Posted: Nov 20, 2005 6:08 AM
Reply to this message Reply
> > Might some intermediary language or format be best, and
> to
> > write XSLTs to transform to and from each language and
> > that?
>
> Yes, I believe you are correct, and that is what I am
> trying to do. I am targetting an XML format as an
> intermediate format which represents an AST (Abstract
> Syntax Tree) as generally as possible. This format, which
> is not yet fully specified, I'm calling ASTXML for the
> time being.
Why not use the CIL? Microsoft has already solved many of the questions that arise when trying to unify languages.

The only step that MS didn't do is save the source files in CIL instead of C#, VB, etc. Maybe they wanted you to allow editing the sources with any editor besides Visual Studio.

Andy Dent

Posts: 165
Nickname: andydent
Registered: Nov, 2005

Re: XSLT: The Other Programming Language in your Browser Posted: Nov 25, 2005 2:38 AM
Reply to this message Reply
I've written a partial translator for the XML output that REALbasic (http:://www.realsoftware.com/) saves its projects into. This doesn't translate method contents but creates matching Java declarations and grouping constructs so I can feed them into Doxygen.

My advice for anyone trying to learn XSLT is to go and study a little bit of Scheme, say the exercises in the first few chapters of The Little Schemer. Once you have your head around how pattern matching and recursive semantics work, you can tackle the truly awful XSLT syntax.

We also use XSLT quite a bit in web services work, mainly in spatially-related services.

Flat View: This topic has 9 replies on 1 page
Topic: What is XML? Previous Topic   Next Topic Topic: Presenting a Simpler Alternative to XML: PicoML


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us