Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2007, 12:17 PM
Authorized User
 
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default checking for a child?

Hi all!

What is the XPath expresion used to check if a child is existent or not?
For example I want to test if a "Day" element has a "Time" element or not...

Example:

Code:
<Day date="1">
 <Time slot="9:00 am"/>
 <Time slot="9:30 am"/>
</Day>
<Day date="2"/>
<Day date="3"/>
Thanks,
Gabi.

 
Old March 7th, 2007, 12:42 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

<xsl:if test="Time"/>

or

<xsl:if test="child::Day"/>
 
Old March 7th, 2007, 02:18 PM
Authorized User
 
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That did it!!!

Thanks a lot!!

Gabi.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking for valid child elements. Chamkaur XSLT 0 January 25th, 2007 06:51 PM
Checking for Duplicates timeware ASP.NET 2.0 Professional 2 July 20th, 2006 08:41 AM
Opening MDI Child on Button Click of MDI Child Sachin Shinde Visual Studio 2005 0 June 8th, 2006 05:05 AM
Add attribute to the parent after checking child kinnur XSLT 10 May 30th, 2005 06:07 PM
Checking a ComboBox Salte C# 2 November 30th, 2004 05:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.