We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error on Generation PDF file using XML and XSLT

Hi I am trying to generate PDF file using XML and XSLT but it's throwing error (Unable to cast object of type ' . ' to type ' . Unable to cast object of type ' . ' to type ' . ) when creating Document object with XML file and XSLT file.

Can anybody know what is the issue?

--------------------------------Code----------------------------------------

string dataDir = @"C:\TestsData\"
string name = "test";
string inputXmlFile = dataDir + name + ".xml";
string inputXsltFile = dataDir + name + ".xslt";
string outPdfFile = dataDir + name + ".pdf";

XslFoLoadOptions options = new XslFoLoadOptions(inputXsltFile);
Document doc = new Document(inputXmlFile,options);

doc.Save(outPdfFile);

-----------------------XML File:----------------------------------------

<?xml version="1.0" encoding="UTF-8"?>


Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985


Hide your heart
Bonnie Tyler
UK
CBS Records
9.90
1988


Greatest Hits
Dolly Parton
USA
RCA
9.90
1982

--------------------------------------------- XSLT File-----------------------------------------------------

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">




My CD Collection













Title Artist



</xsl:stylesheetv

Hi I am trying to generate PDF file using XML and XSLT but it's throwing error (Unable to cast object of type ' . ' to type ' . Unable to cast object of type ' . ' to type ' . ) when creating Document object with XML file and XSLT file.

Can anybody know what is the issue?

--------------------------------Code----------------------------------------

string dataDir = @"C:\TestsData\"
string name = "test";
string inputXmlFile = dataDir + name + ".xml";
string inputXsltFile = dataDir + name + ".xslt";
string outPdfFile = dataDir + name + ".pdf";

XslFoLoadOptions options = new XslFoLoadOptions(inputXsltFile);
Document doc = new Document(inputXmlFile,options);

doc.Save(outPdfFile);

-----------------------XML File:----------------------------------------

<?xml version="1.0" encoding="UTF-8"?>


Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985


Hide your heart
Bonnie Tyler
UK
CBS Records
9.90
1988


Greatest Hits
Dolly Parton
USA
RCA
9.90
1982

--------------------------------------------- XSLT File-----------------------------------------------------

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">




My CD Collection













Title Artist



</xsl:stylesheet

Hi Tushar,


Thanks for using our API’s.

I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as PDFNEWNET-39556 in our issue tracking system. We will
further look into the details of this problem and will keep you updated on the
status of correction. Please be patient and spare us little time. We are sorry
for this inconvenience.