[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: checking for element in CDATA

Subject: RE: checking for element in CDATA
From: Cams Ismael <Ismael.Cams@xxxxxxxxxxxxxxx>
Date: Tue, 27 Aug 2002 11:32:35 +0200
xsl if cdata
Hello,

A CDATA section is treaten as a normal text node. So the stylesheet returns
the text in the CDATA section.
On the returned text you can use the contains() method to check if your text
is available.

So you could use:
	<?xml version="1.0"?>
	<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="/">
		<xsl:apply-templates select="element/example"/>
	</xsl:template>
	
	<xsl:template match="element/example">
		<xsl:variable name="CDATASection">
			<xsl:value-of select="text()"/>
		</xsl:variable>
		<xsl:if
test="contains($CDATASection,'&lt;ArticleHistory&gt;')">
			TRUE
		</xsl:if>
	</xsl:template>
	</xsl:stylesheet>

Kind regards,
Ismaël

-----Original Message-----
From: Srinivas Ch [mailto:sideburnch@xxxxxxxxx]
Sent: Tuesday, August 27, 2002 11:22 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  checking for element in CDATA


Hallo everyone,
I have write a xsl to check if there is an element
present in CDATA, how to do this.
Here is an example
<element name="ArticleHistory">
   <example><![CDATA[<ArticleHistory>
      <RegistrationYear>2001</RegistrationYear>
      <Received>
         <Year>1999</Year>
         <Month>9</Month>
         <Day>7</Day>
       </Received>
   </ArticleHistory>]]>
  </example>
</element>

so here I have to check if <ArticleHistory> is present
inside CDATA.
How to do this?
Thanx,
Sri


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.