I’m trying to make a simple pdf from an xml (with attached xsl) document.
The XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xsl.xsl"?>
false
Microsoft Access 97
8.0
Microsoft
Windows
-
-
false
Microsoft Word 97
6.0
Microsoft
Windows
-
-
----
----
According to your definitions, lines below should be enough to atleast create and save it, but I’m thinking that the XML document is not properly formatted. I only get an empty pdf document.
Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf
pdf.BindXML(“C:\inetpub\wwwroot\pdf\XML.xml”, “C:\inetpub\wwwroot\pdf\XSL.xsl”)
pdf.Save(“C:/pdftest/GridReport.pdf”)
How do I make pdf from XML, save it and open it in browser?
Dear dpouls1,
Thanks for your consideration.
Did you use correct xslt file? Please view Hello World - XML and XSLT about how to use XML and XSLT.
Yes I use the correct xslt, but it is not formatted with , or tags. Must it follow certain standards?
My xslt:
<?xml version="1.0" encoding="UTF-8"?><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" media-type="application/vnd.ms-excel"/> <xsl:template match="/"> <html> <style> td {font-family:verdana;font-size:10px} th {font-family:verdana;font-size:11px} </style> <body> <table border="1"> <tr> <th>Name</th> <td> <xsl:value-of select="XmlExport/Agent/Name"/> </td> </tr> <tr> <th>Division</th> <td> <xsl:value-of select="XmlExport/Agent/Division"/> </td> </tr> <tr> <th>Node</th> <td> <xsl:value-of select="XmlExport/Agent/Node"/> </td> </tr> <tr> <th>LastScanDate</th> <td> <xsl:value-of select="XmlExport/Agent/LastScanDate"/> </td> </tr> <tr> <th># of products</th> <td> <xsl:value-of select="XmlExport/Agent/TotalNumberOfProducts"/> </td> </tr> <tr> <th>Is clone</th> <td> <xsl:value-of select="XmlExport/Agent/IsClone"/> </td> </tr> </table> <br/> <table border="1"> <tr> <th>Is removed</th> <th>Name</th> <th>Version</th> <th>Vendor</th> <th>Platform</th> <th>Category</th> <th>Description</th> </tr> <xsl:for-each select="XmlExport/Agent/Product"> <tr> <td> <xsl:value-of select="IsRemoved"/> </td> <td> <xsl:value-of select="Name"/> </td> <td> <xsl:value-of select="Version"/> </td> <td> <xsl:value-of select="Vendor"/> </td> <td> <xsl:value-of select="Platform"/> </td> <td> <xsl:value-of select="Category"/> </td> <td> <xsl:value-of select="Description"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template></xsl:stylesheet>
Dear dpouls1,
Thanks for your consideration.
You should re-write your xslt file to Aspose.Pdf’s format. Please view our example.