Re: testing element's contents
At 12:56 PM 10/3/2002, you wrote:
Thanks Wendell. Thinking it over, your simple template of
The test will work for these cases.
If there are any elements that contain non-whitespace text anywhere inside your p, you'll get a wrapper with this test. You just need to decide whether this describes your requirements accurately. For example, maybe if you had
<p><ul><li>list with one item</li></ul></p>
you'd want to strip that p (whereas the test I've given will create a p in output for this). I dunno, it depends on your source and what you're doing with it.
The real point is if you can characterize your requirement more simply, you can write simpler code. Lots of overlapping tests on the presence of certain element types in certain positions make me nervous: a recipe for incompleteness, confusion and breakage under maintenance. To be avoided if possible.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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