Jump to content

Parse a XML to SVG with XSLT


ColtSanderus

Recommended Posts

Hello,I would like to put some XML data in a HTML. In the upper part I need the information in a textual format, in the lower part I want this information in a trend.So, I first need to create the SVG file, but how do I perform this in VB6: CreateSVG(SourceXML, StyleSheetXSLT) as ResultSVG ?In the next step, I want to embed the SVG-file into the HMTL, together with the same XML data transformed to html.Regards

Link to comment
Share on other sites

Honestly said, I don't see the point of that VB6 function. It sounds like a simple function for executing any XSLT transformation.You can have a single XML file and a single XSLT transformation which will create XHTML file with embedded SVG in it. Note that the output must be XML and initiate another XSLT transformation which would just copy the output. That will allow you to actually render the output properly in all browsers, including IE.

Link to comment
Share on other sites

Thanks for your answer.Indeed... I was also thinking about this solution but then I found this on W3Schools: (SVG section)I Wish....It would be great if we could add SVG elements directly into the HTML code, only by referring to the SVG namespace, like this:

<htmlxmlns:svg="http://www.w3.org/2000/svg"><body><p>This is an HTML paragraph</p><svg:svg width="300" height="100" version="1.1" ><svg:circle cx="100" cy="50" r="40" stroke="black"stroke-width="2" fill="red" /></svg:svg></body></html>

I tried to embed a SVG in the HTML, it didn't work.Note: that easy XSLT transform function you mentioned... in which VB6 class or library are these functionalities available? MSXML? I am not really familiar with these featers.

Link to comment
Share on other sites

I mean a second transformation. A normal one. From the browser, with a processing instruction for the stylesheet (the way which is done in W3Schools' XSLT tutorials). That XSLT itself should be:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><xsl:copy-of select="*"/></xsl:template></xsl:stylesheet>

If applied to an XHTML document served (or saved as) XML (either have "xml" as the file extension or send "application/xml" as the content type HTTP header), it will render HTML with embedded SVG (only viewable if the client has SVG viewer of course).The XHTML code you'll use is pretty much what this "I wish" shows.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...