xsl-list
[Top] [All Lists]

Detecting the tags inside CDATA section

2003-07-12 23:59:35


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
            &quot;requestsynch&quot; 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(_at_)cs(_dot_)indiana(_dot_)edu)

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



<Prev in Thread] Current Thread [Next in Thread>