4 ms·
I think this article is oh-so-close to making some great points. Using a DSL like XSLT for XML transformation is a lot more productive than in Java. "Quite si
by 16bytes 13y ago
I think this article is oh-so-close to making some great points. Using a DSL like XSLT for XML transformation is a lot more productive than in Java.
"Quite simply, each language is good for its specific task, but can't (easily) do anything else."
Correct, let XSLT do what XSLT does (transform XML), and fill in the rest with Java. I've been paying attention to XProc for a long time and seems to be good fit for what it does, (manage series of XML transformations).
"All I need to do is use that XSLT directory listing function... that function that doesn't exist."
Well, that's true. I'm surprised that somebody extolling the virtues of Haskell would miss this point, but XSLT is supposed to be a pure-functional language. You should't make side-effect/non-deterministic calls during a transformation. Furthermore, since he discovered the ability to write to multiple output documents in XSLT 2.0, I'm surprised that he didn't think of multiple input documents.
The answer here would be to use java to produce all of the necessary input before the xslt/xproc pipeline. Create a temporary DOM filled with just a directory listing, you can configure Saxon to select on arbitrary documents that you create, and do it all in memory. Xproc is meant to make transformations composable in case you don't explicitly know everything beforehand, like if there's dynamically generated file content that gets populated from earlier transformations, but I think it's less useful than XSLT.
"Contrast this with the DOM model from Java."
Well, an API discussion on Java/DOM is a different matter entirely.
"Ant and XSLT are not designed for modularity."
Yes, they are. They are modular with respect to their domain models.
If the point was "Well, a client mandated the use of Java, but it wasn't so bad because I was able to do everything in XSLT and XPROC", it would have been interesting. Furthermore, one might have said, "If XSLT was a DSL written as an embedded API in a friendly language with extensible syntax like haskell, ruby or scala, it would have cut out the middle man".
To claim, however, that languages that aren't general purpose are dangerous becuase, well, they aren't general, is bit of a stretch.