Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old July 26th, 2004, 12:57 AM
Registered User
 
Join Date: Apr 2004
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?


 
Old July 29th, 2004, 08:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
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/
 
Old July 29th, 2004, 12:49 PM
Registered User
 
Join Date: Jul 2004
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.

 
Old July 30th, 2004, 06:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
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>")
...





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.