Posts

Showing posts with the label XML

mjst - Micro JavaScript Template Engine

This is the content I've written so far in the official mjst repository . I'd love to know your thoughts about this little experiment, cheers! What mjst is a lightweight, about 1Kb minified and gzipped, and performances focused template engine with standards support. There are dozens JavaScript ? Template Engines solutions out there but as far as I know this is the only one based on validation for both client and server side programming languages. How There is one single function to call: // via text (e.g. Ajax or innerHTML from a template node) var transformed = mjst ( '<?js var hello = "mjst!"; ?><js-hello/>' ); // classic template node example < script id = "mytpl" type = "text/html" >   <? js     var hello = "mjst!" ;   ?>   < js - hello /> < /script> myEl.innerHTML = mjst(document.getElementById("mytpl")); / / via XML ( e . g . Ajax or a created document ) // this is a ...

XML To HTML Snippet

This John Resig post about nodeName demonstrates once again how trustfulness are edge cases in JavaScript. I must agree 100% with @jdalton : frameworks or selector libraries should not be concerned about these cases. First of all there is no universal solution so whatever effort able to slow down libraries won't be perfect, then why bother? Secondly, I cannot even understand why on earth somebody could need to adopt XML nodes in that way. Agreed that importNode or adoptNode should not be that buggy, but at the same time I have always used XSL(T) to inject XML into HTML and I have never had problems. Different Worlds In an XML document a tag is just a tag. It does not matter which name we chose or which JavaScript event we attached, XML is simply a data protocol, or transporter, and nothing else. A link, a div, an head, the html node itself, does not mean anything different in XML so again: why do we need to import in that way? In Internet Explorer we have the xml property which i...

Template Engine - Why Bother? XML + XSLT

I am not sure I read the entire recent " war " in the PHP general mailing list about the best PHP Template Engine Option but, generally speaking, this argument is truly loads of solutions and controversial opinions. Here I am with mine. PHP 5 And In Core DOM, XML and XSLT Apparently, all these " Smarty adorers " did not consider that PHP 5 introduced a lot of core classes to work over DOM, XML, and transform them via XSL files. Nothing to do, they prefer to move an entire template application rather than use the best native, fast, in core, solution . Here a couple of reasons to generally prefer XML and XSL Transformations rather than whatever engine, specially those written in PHP itself, a not that fast interpreted programming language. Think Portable Apparently developers like to be stuck forever in a single programming language , something I cannot even try to consider, since Information Technology means Flexibility and Updates . An extremely valid point to cho...

JXON - A little update loads of documentation

I have updated my lightweight JXON library right now, lightly improving them, and adding a consistent documentation for each method as well. At this point, the last thing I could do about JXON, is to talk about what exactly is, and what is not at all. JXON IS An intermediate, well defined, layer between native JavaScript variables, and a generic page content (their representation inside the layout) A fast and cross-browser JS to XML, and vice-versa, parser A human comprehensive way to represent JavaScript Object Notation via XML using a natural, lightweight, and unambiguous, schema, that will make XSL files creation, manipulation, and maintenance, more clear and natural than ever, working over both XPath, and semantic data types nodes with optional keys for object members A simple and crossbrowser global object, with few methods to transform JavaScript raw data into a valid (x)HTML layout page, or portion An advanced, XSLT based, enterprise ready way to represent d...