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 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Glenn MeadowsSubject: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 24 Oct 2006 01:02 PM
Hello,

From the SS Examples\SVG directory.

I have a CHART.XML and a CHART.XSL.

I need to create a CHART.SVG on the fly using ASP.NET.

Can someone offer any guidance ?

Thanks,
- Glenn




Postnext
Glenn MeadowsSubject: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 24 Oct 2006 08:38 PM
...append this to original post

I have used the attached ASP.NET file which delivers SVG output to the browser in text format and not as a graphic.

The ASP.NET file transforms the CHART.XML file using the CHART.XSL file.

Any ideas on why I am getting text to the browser in lieu of the expected graphic image, would be appreciated.

thanks,
- Glenn


Unknownchart.xml
CHART.XML

Unknownchart.xsl
CHART.XSL

Postnext
Glenn MeadowsSubject: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 24 Oct 2006 08:41 PM
...please refer to previous post as the upload of my asp.net file was not successful.


UnknownDefault.aspx
ASP.NET

Postnext
Glenn MeadowsSubject: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 24 Oct 2006 08:45 PM
...please refer to previous post

The ASP.NET page did not show up as an attachment, so here it is...

//ASP.NET file to transform chart.xml with chart.xsl
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<%@ Import Namespace="System.Xml.XPath" %>

<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
string xmlPath = Request.PhysicalApplicationPath + @"\App_Data\chart.xml";
string xslPath = Request.PhysicalApplicationPath + @"\App_Data\chart.xsl";
XPathDocument xpathDoc = new XPathDocument(xmlPath);
XslCompiledTransform transform = new XslCompiledTransform();
//Load the XSL stylsheet into the XslCompiledTransform object
transform.Load(xslPath);
transform.Transform(xpathDoc, null, Response.Output);
}
</script>

Postnext
Glenn MeadowsSubject: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 24 Oct 2006 08:52 PM
... again, see the previous post

The browser posts the following text to the browser and not the graphic??

Any thoughts appreciated...

<?xml version="1.0" encoding="utf-8" ?>
- <svg width="800" height="500" viewBox="0 0 600 100" xmlns="http://www.w3.org/2000/svg">
- <g transform="translate(-10,-120)">
<text style="font-size:18" x="20" y="5">Sales Figures by Region</text>
- <g style="stroke-width:2; stroke:black">
<path d="M 40 230 L 40 10 L 40 230 L 200 230 Z" />
</g>
- <g style="text-anchor:end; font-size:9">
<text x="36" y="203">10</text>
<text x="36" y="183">20</text>
<text x="36" y="163">30</text>
<text x="36" y="143">40</text>
<text x="36" y="123">50</text>
<text x="36" y="103">60</text>
<text x="36" y="83">70</text>
<text x="36" y="63">80</text>
<text x="36" y="43">90</text>
<text x="36" y="23">100</text>
</g>
<path style="stroke-width:2; stroke:black; fill: red" d="M 50 230 L 50 65 L 70 65 L 70 230 Z" />
<text style="text-anchor:middle" x="60" y="245">NE</text>
<path style="stroke-width:2; stroke:black; fill: gray" d="M 80 230 L 80 180 L 100 180 L 100 230 Z" />
<text style="text-anchor:middle" x="90" y="245">NW</text>
<path style="stroke-width:2; stroke:black; fill: purple" d="M 110 230 L 110 130 L 130 130 L 130 230 Z" />
<text style="text-anchor:middle" x="120" y="245">SE</text>
<path style="stroke-width:2; stroke:black; fill: blue" d="M 140 230 L 140 130 L 160 130 L 160 230 Z" />
<text style="text-anchor:middle" x="150" y="245">SW</text>
<path style="stroke-width:2; stroke:black; fill: green" d="M 170 230 L 170 155 L 190 155 L 190 230 Z" />
<text style="text-anchor:middle" x="180" y="245">Other</text>
</g>
</svg>

Postnext
Ivan PedruzziSubject: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Ivan Pedruzzi
Date: 24 Oct 2006 10:14 PM
Hi Glenn,

IE doesn't understand SVG unless you install a SVG viewer like the one from Adobe http://www.adobe.com/svg. Unfortunately Adobe is planning to end support for its player January 1, 2008 leaving IE users out to the cold.

Other browsers like FireFox and Opera have built-in support for SVG
http://www.mozilla.com
http://www.opera.com


Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
Glenn MeadowsSubject: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 25 Oct 2006 07:38 AM
Hi Ivan,

I already have Adobe's SVG viewer installed. If I cut and paste what the browser is displaying as text and save it as an SVG file, I can then view the file in my browser with the graphics being displayed.

I am quite puzzled on this one.

Thanks for your help. I will try to be creative but any additional thoughts on this would be appreciated.

- Glenn

Postnext
Alberto MassariSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Alberto Massari
Date: 25 Oct 2006 07:58 AM
Hi Glenn,
you should try specifying the MIME type of image/svg+xml, e.g. adding

<%@ Page contentType="image/svg+xml"%>

at the beginning of your .aspx page.

Hope this helps,
Alberto

Postnext
Glenn MeadowsSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 25 Oct 2006 08:16 AM
Hi Ivan,

My aspx file can only accept one Page directive and it currently has
<%@ Page Language="C#" %>

If I add <%@ Page contentType="image/svg+xml"%>,below the line
<%@ Page Language="C#" %>, it complains that my aspx file can only have one page directive.

If I add the contentType as an attribute to the Page directive as
<%@ Page Language="C#" contentType="image/svg+xml"%>, my aspx file does not complain but does not display anything in the browser only to show a blank screen.

Thank you for your help.
- Glenn

Postnext
Alberto MassariSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Alberto Massari
Date: 25 Oct 2006 09:08 AM
Hi Glenn,
you can try adding the command

Response.AddHeader("Content-Type","image/svg+xml")

inside the Page_Load method. Have a look at this article http://www.15seconds.com/issue/030630.htm for more informations.

Hope this helps,
Alberto

Postnext
Glenn MeadowsSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 25 Oct 2006 11:13 AM
Hi Alberto,

I placed the line you suggested into my Page_Load method as the first line of code being

Response.AddHeader("Content-Type","image/svg+xml");

This time I received a blank screen in the browser in lieu of the svg text output. If I put both the chart.xml and chart.xsl into SS and run them, I get the desired graphical results in the output method.

In my aspx file shown here, I think the Response.Output param in my transform method is outputting text and not the expected svg graphic.

// ASP.NET FILE
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<%@ Import Namespace="System.Xml.XPath" %>

<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Content-Type", "image/svg+xml");

string xmlPath = Request.PhysicalApplicationPath + @"datum.xml";
string xslPath = Request.PhysicalApplicationPath + @"datum.xsl";
XPathDocument xpathDoc = new XPathDocument(xmlPath);
XslCompiledTransform transform = new XslCompiledTransform();
//Load the XSL stylsheet into the XslCompiledTransform object
transform.Load(xslPath);
transform.Transform(xpathDoc, null, Response.Output);
}
</script>

Any thoughts,
- Glenn

Postnext
Ivan PedruzziSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Ivan Pedruzzi
Date: 25 Oct 2006 12:17 PM
Glenn,

You have to add the image/svg+xml mime types to you web server and stop re-start the server

See the attached screenshot


Ivan Pedruzzi
Stylus Studio Team


Imagemimetype.png

Postnext
Glenn MeadowsSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 25 Oct 2006 01:00 PM
Hi Ivan,

I have added the mime type to my IIS web server with *.svg being associated with image/svg+xml and I still receive a blank screen after restarting my web server.

My ASP.NET, XSL and XML files have not changed.

Thanks,
- Glenn

Postnext
Tony LavinioSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Tony Lavinio
Date: 25 Oct 2006 02:42 PM
Did you try doing a 'View Source' to see if the output actually
came as you expected? Then at least you can narrow the problem
down to a MIME-type one.

Postnext
Glenn MeadowsSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 25 Oct 2006 02:51 PM
Hi Ivan,

I have found that if I strip out all of the white spaces from the SVG text that is displayed to the browser and then I cut and paste this text to a SVG file, the graphic is then correctly displayed in the browser when I do a File->Open from IE.

I guess I need to find a way to strip white spaces out on the fly...

- Glenn

Postnext
Glenn MeadowsSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 25 Oct 2006 03:20 PM
Thanks to the SS team for help on this.

I think that I have exhausted looking at all possible solutions.

I will now attempt to take my SVG file generated by my SVG editor and use the file as a template where I will use the XML DOM to generate the output I need.

Certainly if anyone has any further ideas on how to solve the aspx solution, I would love to hear from you.

Kind Regards,
- Glenn

Posttop
Glenn MeadowsSubject: Re: CHART.XML + CHART.XSL to CHART.SVG ?
Author: Glenn Meadows
Date: 25 Oct 2006 09:28 PM
Originally Posted: 25 Oct 2006 09:29 PM
Hi Ivan and Alberto,

Success at last. My problem was that my height, width and viewbox attributes of my svg element did not have the correct size to see the graphics.

It always ends up being something simple.

Thank you both for your help on this today. I truly appreciate it.

- Glenn

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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.