This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
nested block elements in xml -> html
- To: <xsl-list at mulberrytech dot com>
- Subject: nested block elements in xml -> html
- From: "Michael Beddow" <gll6mb at smlc01 dot leeds dot ac dot uk>
- Date: Wed, 31 May 2000 08:59:14 +0100
- References: <200005301520.LAA26183@mulberrytech.com>
- Reply-To: xsl-list at mulberrytech dot com
I have this input xml fragment (attributes stripped
for clarity)
<p>
Text before list
<list>
<item>first item</item>
<item>second item</item>
</list>
Text after list
</p>
My templates transform this to an html fragment
<p class="myclass">
Text before list
<ol class="mylist">
<li>first item</li>
<li>second item</li>
</ol>
Text after list
</p>
which looks fine, but isn't. In the xml, as my dtd allows, the
list is nested within the p. But in html, the new ol block
element
implicitly closes the p element, so that the browser
in effect rewrites to
<p class="myclass">
Text before list
</p> <<=============== !!!!
<ol class="mylist">
<li>first item</li>
<li>second item</li>
</ol>
Text after list
</p>
DISASTER. Text after list doesn't get styled (the redundant </p>
is of course ignored by the browser)
Q. How can I write a template that will style Text after list?
(Re-tagging the source xml isn't an option) I can see ways of
doing
this in a static transform by putting an xml->xml transform into
the
pipe ahead of the transform to html, but I need to do the
transform
on the fly.
Michael Beddow
-------------------------
Michael Beddow
University of Leeds UK
gll6mb@leeds.ac.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list