[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

picking apart mixed content

Subject: picking apart mixed content
From: Craig Sampson <Craig.Sampson@xxxxxxx>
Date: Tue, 13 May 2008 14:47:10 -0400
 picking apart mixed content

My DTD allows mixed content in my paragraphs.

<!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

Sample HTML output:
<p>Mary had a <b>little</b> lamb</p>
<p>its fleece ...</p>

Sample input: (with NO text following the list)
<paragraph>Mary had a <emph>little</emph> lamb

Sample HTML output:
<p>Mary had a <b>little</b> lamb</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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.