xsl-list
[Top] [All Lists]

RE: how check if the node exit and display content of it

2005-03-17 19:56:50
Henry, if all you want to do is test for any children, just look along the child:: axis, like so:

   <xsl:template match="Group">
       <xsl:choose>
       <xsl:when test="child::*">
           has children
       </xsl:when>
       <xsl:otherwise>
           no children
       </xsl:otherwise>
       </xsl:choose>
   </xsl:template>

Regards,

--A


From: henry human <henry_human(_at_)yahoo(_dot_)de>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] how check if the node exit and display content of it Date: Thu, 17 Mar 2005 23:52:09 +0100 (CET)


i create xml files .
the node "Group" could has
child:
<Group>
<undergroups>
<Duration>1:9</Duration>
<description>Waiting for data</description>
</undergroups>
</Group>
or could be without child:
<Group>
</Group>
How could i check in my xsl file if this node
has some child (f.example <Duration>
or <description>)
after that i will to display the
Result(f.example Waiting for data) in browser
i tied it with xsl:if test and xsl:variable
but could'nt use it correctly!

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--