XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Stan LansonSubject: Output as XML?
Author: Stan Lanson
Date: 23 Feb 2007 10:54 PM
Hi,

I have a newbie question:

I have XML as input and also want XML as output, I also use the <xsl:output method="xml" version="1.0"> tag to declare that but it doesnt work. I added my stylesheet-path to the header of an XML and than open the XML in my browser.

But the browser always shows HTML and doenst print the the new XML tree. (Tried firefox and IE)

Here an example:

!!!!!!!!! XSL File !!!!!!!!!

<?xml version="1.0"?>
<xsl:stylesheet version = '2.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="xml" version="1.0" indent="yes"/>

<xsl:template match="/">

<xsl:for-each select="//Person">

<Employee>
<xsl:call-template name="test">
<xsl:with-param name="node" select="Name"/>
</xsl:call-template>
</Employee>

</xsl:for-each>
</xsl:template>

<xsl:template name="test">
<xsl:param name="node"/>
<First_Name><xsl:value-of select="$node"/></First_Name>
</xsl:template>

</xsl:stylesheet>

!!!!!!!!! Source XML !!!!!!!!!

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>

<Data>

<Person>
<Name>Peter</Name>
<Surame>Falk</Surname>
</Person>

<Person>
<Name>Inspector</Name>
<Surname>Columbo</Surname>
</Person>

</Data>


Thanks in advance!!

Postnext
(Deleted User) Subject: Output as XML?
Author: (Deleted User)
Date: 26 Feb 2007 08:47 AM
Hi Stan,
both browser display HTML, not XML, so they will render just the text nodes contained in the final XML (in this case, just 'Peter Inspector').

Alberto

Postnext
Stan LansonSubject: Output as XML?
Author: Stan Lanson
Date: 26 Feb 2007 02:31 PM
Hi Alberto,

thanks for your response.

Nontheless I dont understand why I can't display the result as XML. Both browsers can display XML (tree view -> when you open an .XML file you can see it). Can't I force the browser to interpret the result as XML and not HTML?

Regards
Stan

Posttop
(Deleted User) Subject: Re: Output as XML?
Author: (Deleted User)
Date: 26 Feb 2007 04:35 PM
Hi Stan,
the problem is that the XML view that both Firefox and IE show when
asked to display an XML file is built through an XSLT stylesheet
itself (e.g. for IE it's stored in the MSXML.dll and can be accessed
via res://msxml.dll/DEFAULTSS.xsl). And this stylesheet is invoked
only when an XML file is loaded, not when the XML comes from the
generation of another stylesheet.

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.