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 September 20th, 2010, 03:33 AM
Registered User
 
Join Date: Sep 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML tags are not getting displyed in IE

Hi,,

I am new to XSLT and I am trying to transform xml to another xml using XSLT.
When I tried to open output xml in IE ,xml tags are not getting displayed.Only text is getting displayed.
Can someone help me out in this?
Thanks in advance.

Last edited by nagarathnabillawa; September 20th, 2010 at 03:38 AM..
 
Old September 20th, 2010, 03:41 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Sounds like IE is treating the file as an HTML one. In that case unrecognised tags are ignore and their content is displayed.
Can you show a small example of the output and what the file is called?
On a side issue IE is not a suitable development environment for XML/XSLT. You'd be better off using a dedicated IDE such as oXygen, or Altova's XML Spy. Alternatively Kernow provides a GUI over the Saxon proccessor.
__________________
Joe
http://joe.fawcett.name/
 
Old September 20th, 2010, 04:02 AM
Registered User
 
Join Date: Sep 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks joefawcett.
Here are my XML and XSL files.

XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="new.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
</catalog>


XSL file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<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"/>
<xsl:template match="/">
<xsl:element name="root">
<xsl:for-each select="catalog/cd">
<xsl:element name="singer">
<xsl:value-of select="artist" />
</xsl:element>
<br />
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>



And I am getting " Bob Dylan
Bonnie Tyler"

as output in IE.

Last edited by nagarathnabillawa; September 20th, 2010 at 04:21 AM..
 
Old September 20th, 2010, 04:58 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well I concur, IE just shows the data. I'm not sure why. I've seen similar things before though, for some reason IE treats the output as HTML even when it's not.
__________________
Joe
http://joe.fawcett.name/
 
Old September 20th, 2010, 02:30 PM
Authorized User
 
Join Date: Jul 2010
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Do you have to put the tags within the
Code:
 <xsl:text>
in order for the tags to show up in the browser?
So in the xsl you would have something like the following:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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"/>
<xsl:template match="/">
<xsl:element name="root">
<xsl:text><![CDATA[<root> ]]></xsl:text>
<xsl:for-each select="catalog/cd">
<xsl:element name="singer">
<xsl:text><![CDATA[<singer>]]></xsl:text><xsl:value-of select="artist" /><xsl:text><![CDATA[</singer>]]></xsl:text>
</xsl:element>
<br />
</xsl:for-each>
<xsl:text><![CDATA[</root>]]></xsl:text>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

I'm new to xslt too.

Thanks,
 
Old September 20th, 2010, 02:41 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

If you want to use XSLT to transform XML to XML and that XML is not something the browser knows to render (e.g. like XHTML which IE 6, 7, 8 and Mozilla and Opera can render or like SVG which Opera and Mozilla can render or which IE 9 can render) then the browser is not the right tool to run and test that transformation. Use a standalone XSLT processor or an XML editor which allows you to see the source of the transformation result.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old September 23rd, 2010, 06:15 AM
Registered User
 
Join Date: Sep 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Martin.. Let me try with some xslt processor!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
regarding deleting tags in an xml abhi.prince4u XML 0 July 14th, 2007 12:16 AM
Tags as text in XML elements janise XML 16 January 2nd, 2007 06:45 AM
xhtml-tags i xml value-of select patric_jansson XSLT 5 October 3rd, 2005 12:15 PM
Renaming with XML tags? johrik XSLT 1 February 12th, 2004 03:49 PM
ASP not reading all XML tags! jeffm_22 XML 4 July 4th, 2003 01:43 AM





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