|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

July 26th, 2004, 01:57 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Location: Bangalore, Karnataka, India.
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, 09:00 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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, 01:49 PM
|
|
Registered User
|
|
Join Date: Jul 2004
Location: , , .
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, 07:13 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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>")
...
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |