Subject: Re: Detecting the tags inside CDATA section
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sun, 13 Jul 2003 10:17:48 +0200
|
There are no "tags" inside a CDATA section -- it is a regular text node and
its value is a string. If a string happens to contains the text
representation of an xml document, this does not help -- it would be
necessary to call an extension function that will parse this string and
return the node-set comprising of its top element.
> All the data inside the CDATA section here is actually an XML document
Then do put it as-is within the xml document -- not within a CDATA section.
In this case you'd be able to extract it with a single xsl:copy-of
instruction.
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
In case
"Deepti Kodeboyina" <dkodeboy@xxxxxxxxxxxxxx> wrote in message
news:Pine.GSO.4.53.0307130139470.19137@xxxxxxxxxxxxxxxxxxxxxxxxxx
>
>
> I have a problem regarding a CDATA section in an XML file. I want to
> convert this XML file into HTML to be displayed on a portal.My document
> looks something like this
>
> ----------------------------
> XML FILE
> -----------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <gridDataServiceResponse xmlns="">
> <response name="requestsynch">
> <result name="Engine">GDS Engine - request
> "requestsynch" was stored successfully</result>
> </response>
> <response name="executerequestsynch">
> <result name="statement">COMPLETE</result>
> <result name="d1">
> <data><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE RowSet PUBLIC '-//Sun Microsystems, Inc.//DTD RowSet//EN'
'http://java.sun.com/j2ee/dtds/RowSet.dtd'>
> <RowSet>
> <data>
> <row>
> <col>bitternut01.cs.indiana.edu</col>
> <col>1024</col>
> <col>896</col>
> <col>1024</col>
> <col>407626</col>
> </row>
> <row>
> <col>bitternut02.cs.indiana.edu</col>
> <col>1024</col>
> <col>768</col>
> <col>2048</col>
> <col>407522</col>
> </row>
> </data>
> </RowSet>]]></data>
> </result>
> </response>
> </gridDataServiceResponse>
>
> All the data inside the CDATA section here is actually an XML document
> that I want to parse and convert to a html file. But I dont know how to
> detect the tags inside a CDATA section and parse them. Does anyone know
> how this could be done ?
>
> Although it doesnt work my xslt stylesheet looks something like this
> ________________________________________
> STYLESHEET
> ________________________________________
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:util="http://www.oracle.com/XSL/Transform/java/Util"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xalan="http://xml.apache.org/xslt">
>
> <xsl:template match="/">
> <html>
> <body>
> <h2>Query Output</h2>
> <table border="1">
> <xsl:for-each select="gridDataServiceResponse/response">
> <tr bgcolor="#99CCFF">
> <td>Response-<xsl:value-of
select="@name"/></td>
> </tr>
>
> <xsl:for-each select="result">
> <tr>
> <td>Result<xsl:value-of
select="@name"/></td>
> </tr>
> <tr>
> <td><xsl:value-of
select="."/></td>
> </tr>
>
>
> <xsl:for-each select="data">
> <xsl:for-each
select="/RowSet/data/row">
> <tr bgcolor="#FFFFFF">
> <xsl:for-each
select="col">
> <td><xsl:value-of
select="."/></td>
> </xsl:for-each>
> </tr>
> </xsl:for-each>
> </xsl:for-each>
>
> </xsl:for-each>
>
> </xsl:for-each>
> </table>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
>
> I am trying to convert the XML file into a table in HTML. I basically need
> to know how to detect the tags inside a CDATA section.
>
> Thank you,
> Deepti Kodeboyina
> Computer Science Dept.
> (dkodeboy@xxxxxxxxxxxxxx)
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|