 |
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

July 26th, 2004, 12:57 AM
|
Registered User
|
|
Join Date: Apr 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
XML to XML transformation using XSLT
Hi all,
I need to perform a transformation from one XML format to other XML format. Before that, I decided to implement the concept on a dummy XML. So I wrote the following XML:
------- XML ------------
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="books.xsl" ?>
<books>
<book>
<title>Beg ASP3.0</title>
<ISBN>1-861003-38-2</ISBN>
<authors>
<author_name>Sanket</author_name>
<author_name>Keyur</author_name>
<author_name>Deepak</author_name>
<author_name>Jeevan</author_name>
<author_name>Utanka</author_name>
</authors>
</book>
</books>
------------- XSL for the above XML ------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<books>
<book>
<BOOK_TITLE><xsl:value-of select="//books/book/title"/></BOOK_TITLE>
<BOOK_ISBN><xsl:value-of select="//books/book/ISBN"/></BOOK_ISBN>
</book>
<authors>
</authors>
</books>
</xsl:template>
</xsl:stylesheet>
------------------------------
But, when I view it in I.E 6.0, it shows plane html with only Book's name and ISBN. When I view the source, the source is no different from the original XML. But, when I export it to an excel sheet, there I can view the modified XML.
Can anybody please tell me why is this happening?
|

July 29th, 2004, 08:00 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
It's just the way IE does things. It treats the transform result as html, so ignores the tags and just displays the text. Also, View Source always shows the original xml, not the transformation result.
You need something a bit more useful to develop and test your stylesheets. If you're looking for a good freebie, try Cooktop, http://xmlcooktop.com/
|

July 29th, 2004, 12:49 PM
|
Registered User
|
|
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Phil, I want to display db fields in columns and I am using this code:
dim evalRS
Set evalRS=server.createobject("ADODB.recordset")
sqltext = "SELECT ClassNo, EvaluationNo FROM manager_class_query"
evalRS.Open sqltext, "dsn=ClassEval"
dim RecordArray
dim n
Const cField = 0
If Not evalRS.EOF Then
RecordArray = evalRS.GetRows()
Response.Write("<table>")
For n = 0 to 25
Response.Write("<tr>")
Response.Write("<td>")
Response.Write(RecordArray(cField, n))
Response.Write("</td>")
Response.Write("<td>")
Response.Write(RecordArray(cField, n+26))
Response.Write("</td>")
Response.Write("</tr>")
Next
Response.Write("</table>")
END IF
This results in 2 columns of the ClassNo field. I need to display another field EvaluationNo.
Could you help me with this? Thank you.
|

July 30th, 2004, 06:13 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
I don't see what this has to do with XSLT, but don't you just need:
Code:
...
Response.Write("<tr>")
Response.Write("<td>")
Response.Write(RecordArray(cField, n))
Response.Write("</td>")
Response.Write("<td>")
Response.Write(RecordArray(cField+1, n))
Response.Write("</td>")
Response.Write("<td>")
Response.Write(RecordArray(cField, n+26))
Response.Write("</td>")
Response.Write("<td>")
Response.Write(RecordArray(cField+1, n+26))
Response.Write("</td>")
Response.Write("</tr>")
...
|
|
 |