Subject: RE: [xsl] checking for element in CDATA From: Cams Ismael <Ismael.Cams@xxxxxxxxxxxxxxx> Date: Tue, 27 Aug 2002 11:32:35 +0200 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] checking for element in C, Elliotte Rusty Harol | Thread | [xsl] SAXParseException, Yago Alvarado |
[xsl] SAXParseException, Yago Alvarado | Date | RE: [xsl] 8bit ascii encoding, Andrew Welch |
Month |