|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: checking for element in 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,'<ArticleHistory>')"> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








