[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] how check if the node exit and display content of it


Subject: Re: [xsl] how check if the node exit and display content of it
From: JBryant@xxxxxxxxx
Date: Thu, 17 Mar 2005 17:13:40 -0600

If you need to something only when the Duration element is present:

<xsl:template match=" Group">
  <xsl:if test="Duration">
    <!-- Do something -->
  </xsl:if>
</xsl:template>

If you need to do something when the Duration element is present and 
something else when it is not:

<xsl:template match=" Group">
  <xsl:choose>
    <xsl:when test="Duration">
      <!-- Do something -->
    </xsl:when>
    <xsl:otherwise>
      <!-- Do something else -->
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

If that doesn't work, post small (but complete enough to show the problem) 
XML and XSL files, so we can see more detail. Remember to paste the XML 
and XSL into the body of your message, since the list (thankfully) doesn't 
take attachments.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)





henry human <henry_human@xxxxxxxx> 
03/17/2005 04:52 PM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
cc

Subject
[xsl] how check if the node exit and display content of it







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!


thanks
henry






 

 
 
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier 
anmelden: http://mail.yahoo.de


Current Thread
Keywords