So, in our Dracula exercises, XSLT 4 and XSLT 5, we were looking at chaining a series of functions together, mostly using the arrow operator from XPath 3.0: => to do things like take distinct-values, sort, and bundle a sequence of things together with string-join. But as soon as we needed to do some "string-surgery" on our nodes, tonormalize-space() on them one by one (or if we wanted to translate() a character out or replace it with something, for example, we'd have to go one by one over our nodes and the => operator won't work! We had to turn to the simple map operator ! instead, because that handles JUST one thing at a time and does what's needed. And we had to position it first in the series for reasons of processing our nodes one by one before sending them over to distinct-values, etc. If you find it confusing to work out when you have to use ! and why you can't just use the => all the time, you're not alone! Sometimes we figure it out by trial and error, and knowing that you can try the ! if the => doesn't work.
So, in our Dracula exercises, XSLT 4 and XSLT 5, we were looking at chaining a series of functions together, mostly using the arrow operator from XPath 3.0:
=>
to do things like take distinct-values, sort, and bundle a sequence of things together with string-join. But as soon as we needed to do some "string-surgery" on our nodes, tonormalize-space()
on them one by one (or if we wanted totranslate()
a character out or replace it with something, for example, we'd have to go one by one over our nodes and the=>
operator won't work! We had to turn to the simple map operator!
instead, because that handles JUST one thing at a time and does what's needed. And we had to position it first in the series for reasons of processing our nodes one by one before sending them over to distinct-values, etc. If you find it confusing to work out when you have to use!
and why you can't just use the=>
all the time, you're not alone! Sometimes we figure it out by trial and error, and knowing that you can try the!
if the=>
doesn't work.Since we were all just talking about this in class on Friday, I was excited to see that @michaelhkay has ALSO just written a blog post on the subject, with some interesting new ideas for how to make all this "function chaining" we've been doing easier to read and write! If you're curious, take a look at his blog post here and see what you think of the new expressions he proposes. https://dev.saxonica.com/blog/mike/2020/11/19-arrow-expressions.html?fbclid=IwAR3KtYguSLdYhrFL9Qmb4r9Lw60l9tuVRsD_5bJ43y3nMxUFzkBwwXicKzI
Pinging textEncoding peoples and some old friends: @alexvanwoert @AliceR98 @am0eba-byte @Beeplosion @BarbieCessar @bwm5473 @Cameron-Bigi @wdjacca @dxh405 @Emily-Levi @trumerfe @argynarg @AtomicOlsen @Joelpie @Kennaab @amayadwillis @N00000DLE @natalyamyers @san5281 @sxa585 @amw6765 @zteyssier @haggis78 @djbpitt @wendellpiez @rjp43 @nlottig94 @zme1 @frabbitry @amberpeddicord @smdunn921 @alnopa9 @gabikeane