- markup (52)
- xml (7)
- xslt (21)
- atom (8)
- overlapping markup (2)
- schema (9)
- creole (4)
- xforms (1)
- pipelines (7)
- coding (2)
- dtll (1)
- genealogy (3)
- gtd (1)
- hardware (1)
- legislation (1)
- ontologies (2)
- unicode (1)
- web (24)
- google (3)
- rdf (6)
- rest (3)
- wikis (1)
- work (1)
- xpath (1)
- xquery (1)
- xtech2008 (3)
- life (26)
- children (5)
- equality (6)
- environment (4)
- gadgets (5)
- software (3)
- xlinq (2)
- conferences (7)
- xtech (6)
- blog (7)
- drupal (3)
Re: Matching templates, named templates or for-each? My rules of
The other reason I would normally use named templates that depend on the context node is to factor out code that is common to a number of element types where you wouldn’t want (or be able) to simply extend the match statement. This most often occurs where you have templates that handle some base type and you want to make it easy to apply that processing to specializations of that base (either in the strict XSD sense or in the looser DITA sense of specialization).
I also try to document what the expectations on the context node are (otherwise, like you say, it can be very difficult to debug or understand later).
For example, I might do something like this:
and in a stylesheet for my customization I might have:
Is there a more effective way to do this (short of having either type-aware templates or using DITA-style class= attributes and corresponding match values).
Cheers,
Eliot