Re: [xsl] testing element's contents

Subject: Re: [xsl] testing element's contents
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Thu, 03 Oct 2002 21:40:46 +0200
So a text node in a <Caption> element shell not cause a <p> in the output? Ok, no problem, only the XPath becomes more and more complex:

test="descendant::*[not(self::Link or self::Media or self::Caption)]

This tests now whether

a descendant element exists, which is not Link, Media or Caption
a text node containing non-whitespace characters, which has not Caption as parent.

| is the union operator, which unions the two node sets descendant::* and descendant::text(). If the union is not empty, the test is passed.



Nathan Shaw wrote:

Thanks. Very close now...

The only thing causing a problem now is that a Media
element can contain two child elements, Link and/or
Caption. I actually had a Link element outside of a
Media element before, but that *SHOULD* not happen.
Both the Link and Caption elements contain text nodes.
So, something like this:

   <Media type="image" id="1"
width="54" height="54" border="" alt="Picture of the
shuttle parachute.">
      <Link url="mytestfile.htm" type="external"/>
      <Caption align="bottom">Picture of the shuttle

will pass the test even though it is only an image.

Sorry I left that out. That is the only snag left
preventing your solution from working.

I tried adding to it myself, but I just do not
understand axis conditionals well enough.

or descendant::Link or descendant::Caption)]">


XSL-List info and archive:

Current Thread