12

There’s just no love for XSLT. Some people tell me it’s not even a language.

Comments
  • 0
    Any benefits over CSS? I've always seen it as an XML'ified version of CSS
  • 2
    @3rdWorldPoison Think you are confusing xpath with xslt here.
  • 5
    @hjk101 Isn't Xpath just an addressing mechanism?

    Also thanks @devphobe for introducing me to XSLT. Quite a relic. I didn't know we had such good templating with XML.

    Also sorry for calling it CSS lmao :D
  • 1
    @3rdWorldPoison for selection yes. Like css selectors. It's the part that is comparable and sometimes used interchangeably.
  • 1
    XML itself is way too verbose even for a schema-less encoding. If you already have a schema, structure descriptions should occupy 1 byte per variable-length element and 1 byte per optional element per message. Maybe a bit more if your encoding can do funny things, but definitely not as much as XML. In comparison, JSON is relatively low price for readability.
  • 0
    So XSLT still is a thing?

    Fifteen years ago, when i saw a single specimen, most already believed it to be extinct in the wild...
  • 2
    i actually kinda liked it when i discovered it, moreover at the time when i got probably the only project where using it seemed to make sense:

    get xml data from a service, xslt it into a html page presenting it in a nice way.

    it was cool, while i was being ot that single project ever where using it made sense.
  • 0
    @3rdWorldPoison see my comment above this one.
  • 0
    I wish there was better support for XSLT in C++. The libraries that exist are all C if I remember correctly. I like XSLT because I can convert a document to another representation by changing just the XSLT. I did this in a project 2 years ago. We were originally writing straight HTML. However, we changed to a really crappy HTML rendering engine. So I did the output in XML. Then before presentation I convert to the crappy HTML with XSLT. At some point I will redefine the XSLT and output another format altogether. Because it is in an intermediate format I can output the same XML to JSON for instance. If we have a need.

    Best XML/XSLT library I ever used: lxml for Python.
  • 1
    I actually used it once to generate HTML and PDF from xml-serialized objects. Was quite handy. Though it is veeery old and finding good documentation seems almost impossible.
  • 0
    @hjk101 Err, no. XSLT is a way to show formatting for XML documents. Just like CSS. Just a lot less featureful.

    Xpath is just an addressing mechanism, as @3rdWorldPoison stated.
  • 0
    @junon XSLT is a way to 'show formatting' for XML documents? What does 'show formatting' mean in this context? It transforms documents and is turing complete. It does not produce XML unless you tell it to.
  • 3
    @Demolishun CSS is turing complete as well. Being "turing complete" is an incredibly low bar, by the way. I don't see how it has anything to do with CSS vs XSLT, either.

    XSLT just transforms XML, usually for display purposes. It formats XML data in whatever target medium you want. That's why XSLT documents are called "stylesheets". It serves the same purpose as CSS, even though CSS is a bit less generic than XSLT.
  • 0
    @junon I see what you mean.
  • 2
    @junon The T of transformations makes it something different than a view/display adaptation as CSS does in my opinion. There a of course similarities amoung them the selecting/addressing of elements but CSS has no power over the data and structure.
  • 0
    @hjk101 CSS has power over the data with `content` and I'm not sure what you mean by 'structure' here.

    Also, it doesn't matter. XSLT was invented primarily for displaying XML in other media/presentations. We can argue semantics all day; there's not much else to argue over, however.
  • 1
    @junon I think he means that the xslt transformation can produce anything. Hence the structure. The output is not xml unless you define it to be xml. CSS doesn't change the fact that html is still html. I think you mean it affects the presentation in a similar way for both technologies.
  • 0
    @Demolishun XSLT doesn't change the original data either. You need XML + XSLT -> output.

    Again, we're arguing semantics here, which is pointless.
  • 1
    @junon It is perfectly valid for an xslt transformation to change the data, or even not output anything. So it very much can change the data.
  • 0
    @Demolishun You are completely right one worked for a company where you can upload docx and odt files XSLT is used for processing it into the required data structure. It's you would diff the original XML with the output you would get back almost every line changed.

    Even CSS content does not do anything with the DOM it's a real time display only thing. Perhaps there is an CSS processor implementation out there that actually transforms html but I have never seen it. Have seen quite some XSLT implementations used as filter, fixer (for Adobe InDesign crappy output) and plain text/PDF converter.
    In fact I've never used it seen it used just displaying stuff differently (without storing the altered output).
Add Comment