p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XSLT
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 26th, 2004, 01:57 AM
Registered User
Points: 40, Level: 1
Points: 40, Level: 1 Points: 40, Level: 1 Points: 40, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Bangalore, Karnataka, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old July 29th, 2004, 09:00 AM
Friend of Wrox
Points: 2,450, Level: 20
Points: 2,450, Level: 20 Points: 2,450, Level: 20 Points: 2,450, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old July 29th, 2004, 01:49 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old July 30th, 2004, 07:13 AM
Friend of Wrox
Points: 2,450, Level: 20
Points: 2,450, Level: 20 Points: 2,450, Level: 20 Points: 2,450, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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>")
...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is XML supports transformation of HTML to XML? zeeonline XSLT 1 July 28th, 2006 06:13 PM
Problem in XML to XML transformation jkuravatti XSLT 2 May 5th, 2006 12:21 PM
XSLT transformation from XML buffer and XSL file sundaramkumar Javascript 1 September 5th, 2005 03:11 AM
Xml to Xml Transformation using xslt ShaileshShinde XSLT 1 July 20th, 2005 02:20 AM
XSLT for complicated xml to xml transf. required doug@sirvisetti XSLT 3 June 17th, 2005 05:26 PM



All times are GMT -4. The time now is 03:19 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc