4 ms·
Why would you write code for that? It’s just a few lines of XSLT!
by mrcode007 2y ago
Why would you write code for that? It’s just a few lines of XSLT!
- simonw 2y agoXSLT is the perfect example of a technology that I might consider using today if I can get an LLM to do all of the work for me - see also jq and AppleScript which I use frequently now after avoiding them both for years.
- mrcode007 2y agoI think you missed the point. People attempt to solve problems with LLMs that are problems only to them because they are unaware of existing solutions that have solved the these “problems” a long time ago. If you don’t know something exists, you can’t ask an LLM about it.
- simonw 2y agoAsking "give me options for" is one of my go-to prompts for this kind of thing. I just tried "Give me options for converting XML to JSON" and XSLT was 5th out of the 6 it gave me: https://chat.openai.com/share/85aa3e93-f557-426c-b0ce-f3bce7822cb3 https://chat.openai.com/share/85aa3e93-f557-426c-b0ce-f3bce7...
- bonzini 2y agoDoes it do escaping in a reasonable way?
- simonw 2y agoI played around with it a bit and it looks like you have to do some pretty gnarly things to get JSON string escaping to work in XSLT output - at least for the XSLT 1.0 version supported by most web browsers: https://chat.openai.com/share/4bc7922b-b1c2-411c-aef9-b41b0f0e9936 https://chat.openai.com/share/4bc7922b-b1c2-411c-aef9-b41b0f...
- AlienRobot 2y agoReally? I don't know a lot about XML's advanced features so I thought XSLT was just a way to convert one XML document into another.
- fweimer 2y agoXSLT 3.0 defines an XML representation for JSON documents: https://www.w3.org/TR/xslt-30/#json https://www.w3.org/TR/xslt-30/#json I'm not sure how fun it is to work with in practice, given that the XML representation is quite verbose.
- kragen 2y agopossibly because it's easier to ask gpt-4 to write code to do it than to ask saxon to do it, because you can ask in english rather than xslt?