[xsl] Best practices when reorganizing content?
My general stylesheet design is to try and leverage templates that match
things and produce output as they are found in the document order. In
some cases the templates will process the content and other times it
will ignore/hide the content. If I'm worried the format will evolve I'll
try and add a wildcard template <xsl:template match="*"> and report
elements that weren't in my original source to trigger a review oof the
output.
That works well for me with something that is generally in the same
order of output and content is nested nicely that I might ignore whole
sections.
I'm now trying to process JSON that was developed for a completly
different purpose and the content has to be transformed in a very
specific order. Also because it is coming from JSON i don't have nice
element names to reference.
Currently I start a template and then try and target the specific
sections with if statements to make the decision to output or not - more
procedural.
I run the risk of missing additions to the content that I might want to
do something with and I don't have a good way to try and report these
additions and potential deletions.
I've got a fair amount of content being managed and it has given me an
idea of what is going on in the content that I didn't have when I
started, such that I'm going to see if I can try a different approach.
The other issues is that the content doesn't have any sort of
model/scheam/dtd that is used to validate the results and it looks like
anyone can add any structure (or not follow existing patterns) when ever
they want. This structure has morphed over the last 2yrs of use so I
have early content designs with more recent designs.
What I'm trying to achieve:
- stylesheet that is less procedural
- reporting of new structures that I might want to look into
- error reporting when the content I receive doesn't match "my model
view" of what was intended
Any suggestions greaty appreciated.
..dan