4 ms·
XML is interesting case in point that syntax matters. XPath and XSL are so awesome but barely anyone cares because XML.
by scotty79 11y ago
XML is interesting case in point that syntax matters. XPath and XSL are so awesome but barely anyone cares because XML.
- dozzie 11y agoXSL is a case that even authors found XML syntax too obnoxious, so they included special non-XML syntax in string attributes.
- xaduha 11y agoIt was practical, easy enough to do and didn't break any existing stuff. It's still XML, right? So why not? Nothing to do with obnoxiousness.
- spdustin 11y agoAre you referring to Attribute Value Templates? <div id="{@ID}"/> It's simply a built-in template for "xsl:value-of" result fragments to be embedded directly in the literal result fragment's attribute. Call it "string interpolation", since it effectively serves the same purpose specifically for attributes in your literal markup for a given template. <div> <xsl:attribute name="id"> <xsl:value-of select="@ID"> </xsl:attribute> </div> AVT is much nicer, to my eyes, though I will use the longer notation for more complex values. And, by definition, it's standard XSL.
- xaduha 11y agoIt's easy enough to create an alternative syntax for it, one-to-one translation. For HTML (XHTML?) there are plenty examples already like Jade. http://jade-lang.com/ http://jade-lang.com/ But people who are serious about XML-related technologies understand that syntax of XML is mostly fine, interoperability and existing tools matter way more. It would be hard for such an alternative syntax to catch on. People often forget that it is a direct descendant of SGML, I imagine for similar reasons - there were existing tools for it.
- scotty79 11y ago> syntax of XML is mostly fine If that was entirely true there'd be no JSON.
- xaduha 11y agoAre you even serious? Of course there would be different formats for every goddamn thing under the Sun. What really happens there is called Impedance Mismatch Similar to this, but with XML https://en.wikipedia.org/wiki/Object-relational_impedance_mismatch https://en.wikipedia.org/wiki/Object-relational_impedance_mi... Remember how Scala had XML as a first class citizen in the language? It didn't work out that well. There are different programming paradigms and I would (entirely serious here) say that XSLT, XQuery, XProc and related XML technologies belong to a separate category. It's mostly declarative and pure, but there are some imperative elements here and there. It's just a different way of doing things, which has XML and XPath at the very center. JSON doesn't have that Impedance Mismatch with Javascript and languages that support JSON well, that's why it's there.
- scotty79 11y agoI'm serious. We had AJAX not AJAJ. JSON mostly replaced XML in its only popular application. There would be no point of having JSON (as a thing not just JS notation for object literals) if XML wasn't that horrible to look at. > Remember how Scala had XML as a first class citizen in the language? It didn't work out that well. Funny how well having (sort-of) xml as first class citizen works in React ecosystem (in HTML too, to some degree). Easily composable bite sized chunks without over-engineered namespaces, doctypes and such. If only xml designers thought of their creation as pieces of flexible, composable hierarchical data not as documents. > It's mostly declarative and pure, but there are some imperative elements here and there. Yes. And despite all that it gets almost no love. My point is that this is mainly because of syntax (a thing that is considered by many, superficial and unimportant). > JSON doesn't have that Impedance Mismatch with Javascript and languages that support JSON well, that's why it's there. I believe you are overthinking this. JSON is just xml subset with slightly different syntax. If there is no mismatch between JSON and Javascript on any level beyond the syntax then there was no mismatch between subset of XML that was used for same purpose before JSON became popular.