[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Test for child node categories
I have the following element definition (I've cut it down slightly for reasons of space but the principle is clear): <!ENTITY % simple "#PCDATA"> <!ENTITY % markup "em|sub|sup"> <!ENTITY % textcontent "%simple;|%markup;"> <!ENTITY % lists "define|list|ul|ol"> <!ENTITY % blockcontent "para|note|warning|table|img|%lists;"> <!ENTITY % complexcontent "%textcontent;|%blockcontent;"> <!ELEMENT answer (%complexcontent;)*> I am writing an XSL transform to output HTML, and the template for <answer> needs to take into consideration whether a) all the children of answer are textcontent; b) all the children of answer are blockcontent; c) there is a mixture of textcontent and blockcontent children So my first question is: how could I write these tests in XSL 1? 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. Case (c) is evidence of a poorly structured document, but the XML is defined by/validated against a DTD not a schema and so I live with the possibility. This will require my stylesheet to generate <div>...</div> while wrapping any sequences of consecutive 'textcontent' children in a <p>...</p>. That leads to the second question: is there a construct that will do this, comprehensible by a bear with very little brain, again in XSL 1? Thanks if you can help Cheers Trevor
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|