I'm happy to see many other XPath fans here. But as far as the OP, this seems like a case of worrying about the code instead of the data structure. This would be easier to address before the lines are transformed into HTML. Which I assume is not how they are stored.
XPath is actually pretty useful once it stops being confusing
71–77 of 77 posts
Re: XPath is actually pretty useful once it stops being confusing
#72XML gets a bad rap because of how much prettier JSON is, but there are a lot of cool tools associated with it. XPath is pretty awesome, I had to write a XPath parser/executor once (for a class) and it made me appreciate the value and simplicity. Then there was XSLT, which was a pretty sweet way to turn a data format into a variety of "print" or "display" formats. Definitely been replaced by bigger and better things b…
XSLT is a turing-complete programming language. Really, the moment your source XML has a slightly different structure from the target output, XSLT files become monsters. Programming in XML is never a good idea. It isn't in XSLT, it isn't in Spring, it isn't in Maven. Anything that's XML and has elements or attributes with names like "if", "else" or "while", something went horribly, horribly wrong somewhere. It's horr…
Re: XPath is actually pretty useful once it stops being confusing
#73> But it gets more interesting if the lyrics are stored as an HTML fragment. Is there any reason to store the HTML version with s and s instead of a plain text and converting it to HTML with simple rules à la markdown? (single line break = , double line break = )
Re: XPath is actually pretty useful once it stops being confusing
#74Earlier quoted context omitted.
XSLT is a turing-complete programming language. Really, the moment your source XML has a slightly different structure from the target output, XSLT files become monsters. Programming in XML is never a good idea. It isn't in XSLT, it isn't in Spring, it isn't in Maven. Anything that's XML and has elements or attributes with names like "if", "else" or "while", something went horribly, horribly wrong somewhere. It's horr…
Would you say »Programming in S-expressions is never a good idea« as well?
Re: XPath is actually pretty useful once it stops being confusing
#75XML gets a bad rap because of how much prettier JSON is, but there are a lot of cool tools associated with it. XPath is pretty awesome, I had to write a XPath parser/executor once (for a class) and it made me appreciate the value and simplicity. Then there was XSLT, which was a pretty sweet way to turn a data format into a variety of "print" or "display" formats. Definitely been replaced by bigger and better things b…
XSLT is a turing-complete programming language. Really, the moment your source XML has a slightly different structure from the target output, XSLT files become monsters. Programming in XML is never a good idea. It isn't in XSLT, it isn't in Spring, it isn't in Maven. Anything that's XML and has elements or attributes with names like "if", "else" or "while", something went horribly, horribly wrong somewhere. It's horr…
Re: XPath is actually pretty useful once it stops being confusing
#76XML gets a bad rap because of how much prettier JSON is, but there are a lot of cool tools associated with it. XPath is pretty awesome, I had to write a XPath parser/executor once (for a class) and it made me appreciate the value and simplicity. Then there was XSLT, which was a pretty sweet way to turn a data format into a variety of "print" or "display" formats. Definitely been replaced by bigger and better things b…
Just curious: what are the "bigger and better things" that have replaced XSLT? From what I can tell, it's still being used quite a lot, especially in the world of structured documentation. For something like transforming massive amounts of XML with a great amount of structural variety to another format, XSLT would certainly be my first choice.
It still can't turn a pile of XML into a pile of PDFs though, so XSLT is definitely king in some arenas.
Re: XPath is actually pretty useful once it stops being confusing
#77Earlier quoted context omitted.
Would you say »Programming in S-expressions is never a good idea« as well?
No. Why?
Just curious; it's just syntax, after all, and I think that XSLT really has an advantage in transforming XML to other XML (or text) compared to a program in other languages.