RE: [xsl] Test for child node categories

Subject: RE: [xsl] Test for child node categories
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Jul 2007 03:11:18 +1200
Thanks for the node tests, useful. May I ask a follow up question?

>> In the output HTML an <answer> element is going to generate a <div>, and
>> case (a) will require a <div><p>...</p></div>, while in case (b) a simple
>> <div>...</div> will suffice.
> 
> it depends how your stylesheet is structured, but it is rather rare that
> you need any explict test, usually you just let the templates for (say)
> answer/para generate the needed <p> element.,

Yes that's fine, it's the mixed content I have a problem with, i.e.

(c) a mixture of textcontent and blockcontent children

e.g.

 <answer>
   What was the question? Oh yes:
   <para>To be, or not to be></para>
   <em>That</em> was the question.
 </answer>

My standard para template will deal with the central <para> element, but the
first text child, and the children which follow the para, both need to be
encapsulated in <p> elements.

This is a pathological case but I still want to generate conformant HTML for
it.

Cheers
T

Current Thread