OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Checking the existence of an Element Tag in xml file

[ Lists Home | Date Index | Thread Index ]
  • From: Oliver Becker <obecker@informatik.hu-berlin.de>
  • To: clhan@gintic.gov.sg
  • Date: Tue, 22 Aug 2000 14:18:30 +0200 (MET DST)

> Does any one out there know how to check whether an  element tag say
> <nameid>  exist in the xml file using xsl  stylesheet?

Just use xsl:if or xsl:choose with an XPath expression to the
element in question.

E.g.
<xsl:template match="/">
   <xsl:choose>
      <xsl:when test="//nameid">Yeah - the document contains a nameid</xsl:when>
      <xsl:otherwise>Sorry, no nameid found</xsl:otherwise>
   </xsl:choose>
</xsl:template>

(Directly typed into my mailer - no warranty for typos)

XSLT questions are better posted to xsl-list,
see http://www.mulberrytech.com/xsl/xsl-list

Cheers,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS