DesignLiquido / xslt-processor

A JavaScript XSLT processor without native library dependencies
GNU Lesser General Public License v3.0
95 stars 30 forks source link

xhtml #31

Closed moonbury closed 1 year ago

moonbury commented 4 years ago

Hi, thank you for sharing the code.

I found that the xslt processor will convert my XSLT string to XHTML standard. That is, it will change my code from <div class="logo"></div> to <div class="logo" />

Is it by design or can the processor stop doing this?

ForbiddenEra commented 2 years ago

I would think this is by design; you're transforming XML. Personally, I prefer serving the result as XHTML5 (application/xhtml+xml)

leonelsanchesdasilva commented 1 year ago

@moonbury We can implement a way to always write the trailing tag.

ForbiddenEra commented 1 year ago

@moonbury We can implement a way to always write the trailing tag.

Awesome!

As an aside, I'm curious about how active this project is and potential updates.

I've ended up using SaxonJS and while it's license isn't currently restrictive, it isn't open source and could change at any time, thus something like this using LGPL is more enticing but I don't want to invest in something that's well behind the times (JS has advanced a lot in the last 5 or so years) or will be abandoned. SaxonJS supports XSLT3 stuff and even JSON as input and output now, which is great working with JS of course; I understand competing with a corporation isn't always feasible and I totally understand that this is free software and have no expectations and appreciate you releasing it regardless, I'm just asking to make the best decision for my own platform, especially since XSLT is probably one of the most important pieces of my platform.

It does seem there's been a fair bit of activity lately which is awesome; I hope you keep up the hard work regardless of whether I decide to currently use it or not - I strongly believe there's a place for a fully free & opensource XSLT processor for JS in the world; SaxonJS is great and I'm glad it's "free" (as in beer) but it's not actually free (as in speech).

Thanks for your efforts regardless!

leonelsanchesdasilva commented 1 year ago

Hi @ForbiddenEra. This project is now active, receiving updates almost every day. I'll keep the updates until it gets robust enough for XSLT 2.0.

My motivation to invest hours and effort on this is exactly SaxonJS: it didn't work well for my needs - for instance, embedding it into a VSCode extension. Contributions from the community are welcome and we accept sponsorship as well.

Appreciate your comment!

ForbiddenEra commented 1 year ago

Hi @ForbiddenEra. This project is now active, receiving updates almost every day. I'll keep the updates until it gets robust enough for XSLT 2.0.

My motivation to invest hours and effort on this is exactly SaxonJS: it didn't work well for my needs - for instance, embedding it into a VSCode extension. Contributions from the community are welcome and we accept sponsorship as well.

Appreciate your comment!

I'll definitely keep my eye on this one then!

I'd definitely suggest considering having the ability to deal with JSON as well; it's great that SaxonJS can take JSON as input and output and translate between them and other things - but mainly, I use XSL as templates for rendering xHTML5 for web pages, now that my platform is on JS, it's more convenient to just push a JS object (as JSON) as input/data for a translation, instead of having to convert my JS object to XML first.

Admittedly, I'm still learning the syntax for accessing JSON input in XSL as it's not quite the same as the normal XPath I'm used to for XML input but I'm it would be great to have.

(I also just realized I could make an XSL template to transform JSON to XML to use as input for projects I have whose templates aren't updated for that syntax to get rid of the not-so-great xml2json module I've been using which has some deprecated dependencies making my OCD spin when npm runs, heh)

I can't commit to contributions or any sponsorship but again like I said I definitely think there's a place for something truly open providing this functionality and will keep my eyes on the project; I'm toying with a newer version of my platform in my spare time (which isn't much) and will definitely at least look at trying it out on there.

If I do end up using it somewhere and I find something I can help with or fix, by all means I'll shoot a PR or create an issue!

Either way, keep up the good work, I'll throw this repo on my notifications and keep an eye on it for sure!

Best of luck - this stuff is definitely not easy in a lot of cases, reviewing IDLs and stuff can be head spinning, though I'm not sure if you're doing it 'raw' like that or depending on some C library (I assume there's likely some libxsl kind of thing in existence)..

And as much as it sucks, XSL is no where near as popular as it should be, very few even know what it is which really just sucks considering it's an open W3C standard and is even (at least 1.0) supported in browsers. Hopefully your project can help gain some momentum on it - I can imagine some people not wanting to use it in their project with there not being a fully open library for it; I started moving my web platform over from PHP and when I started there weren't many options - that's how I initially found this project, fortunately while SaxonJS isn't truly free and open, they at least aren't hugely restrictive - though I also feel like they're not super clear either. PHP did have a good library itself, perhaps you could look at it, though when I used it only 1.0 was supported and it's been ages since then so I'm not sure exactly what it was called though I'm sure the name was probably pretty generic.