Hi Andrew,
The difficulty a beginner faces with any language is envisioning future
maintenance problems - something I do automatically in C++. I am not sure if
I will ever accomplish that for XSLT, but your example was quite
thought-provoking. A few weeks ago, I asked a question on this list about
"XSLT design patterns." I think the example you gave is what I was actually
seeking: how to best address frequently occurring problems. In C++, as with
the maintenance issue, I already have such a repertoire at hand.
Unfortunately, that skill seems to get in the way when probing for XSLT
solutions.
The XSLT cookbook I own assumes one already understands these basic issues
and provides solutions to problems at a less generalized level. I find
Michael's examples, for the most part, make the same assumption [which is
perfectly appropriate in both cases]. But I would love to get my hands on
more examples like your <drink type="beer"/> resolutions.
The difference between the result tree and the serialized output had escaped
my notice. I found most helpful your explanation of how the same node in a
single result tree [<br>] may rendered differently as the tree is
serialized. I had not made any distinction between the result tree and a
serialized document. I had seen references to this difference in the
literature, but had never really understood what was meant.
I still do not understand, for instance, the emphasis in the literature in
distinguishing between the "root" and "the document node"; it seems not to
have any impact on writing code. On the other hand, learning about result
tree serialization will alter my code (I hope). Makes me wonder which other
primitive XSLT notions would be as useful...
Thanks for taking the time,
Mark