RE: [xsl] TestPresence

Subject: RE: [xsl] TestPresence
From: "McNally, David" <David.McNally@xxxxxxxxxx>
Date: Wed, 27 Feb 2002 12:06:07 -0500
How you perform this test really depends on what you're trying to do, but if
you just want a match expression that will only match Theatre elements that
have actor children, then this'll do it:


So from the root node you could do:

	<xsl:template match="//Theatre[actor]">
		<!-- processing for Theatre elements with actor children -->

	<xsl:template match="//Theatre[not(actor)]">
		<!-- processing for Theatre elements without actor children

As has already been mentioned, though, you could also handle it with
apply-templates, or a nested if statement, or any number of other ways.

David McNally            Moody's Investors Service
Software Engineer        99 Church St, NY NY 10007 
David.McNally@xxxxxxxxxx            (212) 553-7475 

> -----Original Message-----
> From: William Rutford [mailto:vsd18@xxxxxxxxxxxxxx]
> Sent: Wednesday, February 27, 2002 10:10 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] TestPresence
> hi
> i have an xml file
> which is looks like below
> <Theatre>
> <actor type="performer" listdefinition="1">
> <actorrank rank="1"/>
> </actor>
> </Theatre>
> I have the requirement to check in xsl if there is any actor 
> element at all in the Theatre node.. If there is any then there 
> are some processing instructions to be applied.
> is there a way in XPATH to check if the <Theatre> has <actor> 
> element or not??
> please help
> w_r
>  XSL-List info and archive:


The information contained in this e-mail message, and any attachment thereto, is confidential and may not be disclosed without our express permission.  If you are not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution or copying of this message, or any attachment thereto, in whole or in part, is strictly prohibited.  If you have received this message in error, please immediately notify us by telephone, fax or e-mail and delete the message and all of its attachments.  Thank you.

Every effort is made to keep our network free from viruses.  You should, however, review this e-mail message, as well as any attachment thereto, for viruses.  We take no responsibility and have no liability for any computer virus which may be transferred via this e-mail message.

 XSL-List info and archive:

Current Thread