How to format XML document for pdf


#1

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?


#2

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.


#3

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="/">


td {font-family:verdana;font-size:10px}
th {font-family:verdana;font-size:11px}



























Name
<xsl:value-of select=“XmlExport/Agent/Name”/>
Division
<xsl:value-of select=“XmlExport/Agent/Division”/>
Node
<xsl:value-of select=“XmlExport/Agent/Node”/>
LastScanDate
<xsl:value-of select=“XmlExport/Agent/LastScanDate”/>
# of products
<xsl:value-of select=“XmlExport/Agent/TotalNumberOfProducts”/>
Is clone
<xsl:value-of select=“XmlExport/Agent/IsClone”/>













<xsl:for-each select=“XmlExport/Agent/Product”>









</xsl:for-each>
Is removed Name Version Vendor Platform Category Description

<xsl:value-of select=“IsRemoved”/>

<xsl:value-of select=“Name”/>

<xsl:value-of select=“Version”/>

<xsl:value-of select=“Vendor”/>

<xsl:value-of select=“Platform”/>

<xsl:value-of select=“Category”/>

<xsl:value-of select=“Description”/>



</xsl:template>
</xsl:stylesheet>


#4

Dear dpouls1,

Thanks for your consideration.

You should re-write your xslt file to Aspose.Pdf’s format. Please view our example.