Re: [xsl] testing element's contents

Subject: Re: [xsl] testing element's contents
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Thu, 03 Oct 2002 17:51:09 +0200
<xsl:when test="descendant::node()[not(self::Link or self::Media)]">

If there is any descendant node (including elements, comments, PIs, text), which is not element Link or element Media, create <p> in output tree.



Nathan Shaw wrote:
hi all,

Thanks to everyone who gave me advice on my previous
post about images and captions. Now, I have another
tricky lil' xslt problem. If a paragraph element
contains ONLY a media element OR a media element
surrounded by a link element and nothing more (read,
no other nodes, be they text or not), such as:

height="255" width="432"/></p>

I need to strip the p tags out of resulting output.

However, if it does contain other nodes, such as:

height="255" width="432"/>This is my news release. The
authors will be typing the news release content in
here! I am not sure what this news release is even
about, but lets see how it comes out in XML, shall we?
As I see it coming out as:</p>

I need to leave it alone.

Here is what I have so far. It only looks to see if a
media element or a media element wrapped by a link
element exists, but does not consider if there is a
text node after a media or link element.

<xsl:template match="p">
	<xsl:when test="((descendant::*[1])[self::Link] and
(descendant::*[2])[self::Media]) or

Thoughts? Ideas? Criticisms?


Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!

XSL-List info and archive:

XSL-List info and archive:

Current Thread