If anyone has experience with writing XML based reporters please drop me a note and lets discuss it!
XML to HTML?
XML to HTML?
I'm writing a report module for this billing program and it needs to output formatted reports. I'm thinking about using XML to gather the data and pass it off to something that will make pretty HTML for me. The problem is that I've never used XML and don't know if XML to HTML is a viable option..
If anyone has experience with writing XML based reporters please drop me a note and lets discuss it!
If anyone has experience with writing XML based reporters please drop me a note and lets discuss it!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
you could leave it in xml, as most (modern) browsers do support xml these days, why translate it to html or xhtml?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
here is an example of how to parse an xml file
and then display it in html format
this includes the xmlparser.dll and pb includes to use it
and you should copy xmlparser.dll to purebasic/compilers folder
http://www.serveurperso.com/~flype/Pure ... L_HTML.zip
and then display it in html format
this includes the xmlparser.dll and pb includes to use it
and you should copy xmlparser.dll to purebasic/compilers folder
http://www.serveurperso.com/~flype/Pure ... L_HTML.zip
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
XML to HTML
Apparently XSLT is an XML transformation language whose sole purpose is to translate XML into onther formats like HTML. I have been investigating this stuff lately and would love to see some support for XML and SVG in purebasic in the future as they are both open and patent free standards I believe.
XML to HTML is very easy, using XSTL and creating a XSL file. See the following code in javascript.
The XSL code could be something like this
Hope this helps.
Code: Select all
<html>
<body>
<script language="javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("xmlfile.xml")
// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("xslfile.xsl")
// Transform
document.write(xml.transformNode(xsl))
</script>
</body>
</html>
Code: Select all
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="html"/>
<xsl:decimal-format name="european" decimal-separator="," grouping-separator="." />
<xsl:template match="/">
<html>
<style type="text/css">
body {font-family:Arial; font-size:8pt;}
table {font-family:Arial; font-size:8pt;}
#wg {font-size:10pt;}
#pagebreak {page-break-before:always;}
</style>
<body>
element1 <xsl:value-of select="root/element1"/><br/>
<br/><hr/>
<xsl:for-each select="root/element1/subelement">
<table width="100%" border="0">
<tr>
<td>subelement</td>
<td><xsl:value-of select="item1"/></td>
<td><xsl:value-of select="item2"/></td>
<td><xsl:value-of select="item3"/></td>
</tr>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Awesome stuff guys.. Thanks Flype for the example!
Thanks aXend for the XSTL stuff, I'm going to investigate how I can implement something like that..
Thanks aXend for the XSTL stuff, I'm going to investigate how I can implement something like that..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
aXend: to better help me understand how this all works (I'm reading, but there is a lot to read!). Could you provide a quickie example of the XML that would make that XSL stylesheet spit something out?
Thanks in advance!
Thanks in advance!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
I think I have a handle on it now.. Just going to find some external (or globally accessible) XSL translation tool and I'm GOLDEN!
[edit].. I would use javascript to render to HTML but I need access to HTML code itself to save (and email, etc).. I don't believe javascript is allowed to write files, so is there any other way to get the HTML code (perhaps from a web gadget or the like?)
[edit].. I would use javascript to render to HTML but I need access to HTML code itself to save (and email, etc).. I don't believe javascript is allowed to write files, so is there any other way to get the HTML code (perhaps from a web gadget or the like?)
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
I think the easiest way is to start iexplore.exe with the html file like I gave as example. In the html file you link the xmlfile to the xslfile and iexplore.exe renders the output automatically using msxml.exe. You can save the output or print the output, whatever you like.
If you have something else in mind: let me know. Good luck.
If you have something else in mind: let me know. Good luck.
When it saves it saves as the javascript, though, because it is rendered dynamically...
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net



