[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] picking apart mixed content
Hello, My DTD allows mixed content in my paragraphs. e.g. <!ELEMENT paragraph (#PCDATA | emph | listU)*> The HTML DTD does not allow lists within paragraphs. I have, using <xsl:text disable-output-escaping="yes"> been able to *cheat* and end my open paragraph in my output when an embedded listU starts (I have this logic in my listU template). I have used the same trick to restart the paragraph once the listU was complete allowing the original paragraph to be ended in my paragraph template rule. This isn't pretty, but works although a side effect is an empty paragraph following the listU when the input has no text, within the paragraph, following the list. Sample input: (with text following the list) <paragraph>Mary had a <emph>little</emph> lamb <listU><item>male</item><item>female</item></listU> its fleece ...</paragraph> Sample HTML output: <p>Mary had a <b>little</b> lamb</p> <ul> <li>male</li> <li>female</li> </ul> <p>its fleece ...</p> Sample input: (with NO text following the list) <paragraph>Mary had a <emph>little</emph> lamb <listU><item>male</item><item>female</item></listU></paragraph> Sample HTML output: <p>Mary had a <b>little</b> lamb</p> <ul> <li>male</li> <li>female</li> </ul> <p></p> I've tried various combinations of normalize-space() and text() in both my paragraph and listU template rules but haven't come up with a reliable way to determine when text proceeds or follows an embedded list. If there's a way to catch the text then I should be able to come up with a way to output the correct HTML without resorting to the "disable-output-escaping" cheat. Of course any way of identifying the presents of the text should also work when there are multiple lists within a single paragraph. I am still using XSL 1.0 and can't change anytime soon. Also I can't change our DTD. Thanks for any help. Craig Sampson
|
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
|