Free Support Forum -


I want to use msxsl:node-set() to calculate an overall total of some subsections.

My xsl is working correct when I use it as a stylesheet to my xml page, the totals are calculate and the page is rendered well.

When I use te same xsl and xml to render with aspose.pdf , the calculation is not done and results in 0.

I think that the xsl:variable has no content.

xsl snippet:
<xsl:variable name="tmpTotal">
<xsl:for-each select="vakken/vak">
<xsl:value-of select="puntenDW"/>

<xsl:variable name="myTotal">
<xsl:value-of select="sum(msxsl:node-set($tmpTotal)/item)"/>
totaal:<xsl:value-of select="$myTotal"/>

xml snippet:



Thank you for considering Aspose.

I am not familiar with xslt. When I use the following code to test, the result for is 0:

XslTransform xsl = new XslTransform();


How do you use it in your application?

Thank you for the quick answer

below is the code I use to bind my xml file to xsl and produce my pdf-file. This all works great.
pdf1.BindXML(doc_xml, Server.MapPath("xsltfile.xsl"));

I was perfectly able to create a " xsl:variable " and work with it. ==> works good.

It is just, that I think that Aspose.pdf does not support the " node-set() "
Is there a way in Aspose.pdf to calculate an overal sum. (i've looked at Formfields, but nothing seems to do the trick).

please help.

Put the following lines in the xml file (heading) and call the xml file in your browser, you will see the result it should create.

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="XSLTFile.xsl"?>

In fact, the code in my upper post is used in Aspose.Pdf to process xslt and xml. I don’t know how to support msxsl:node-set when transform xml with xslt. Aspose.Pdf use the final xml to produce pdf file. I will study this issue. If you know the answer, please tell me.

Using "xsl.Transform" and the stylesheet with the "<Pdf xmlns="Aspose.Pdf">" element the result is NOT good
Commenting out the "<Pdf xmlns="Aspose.Pdf">" and running the transform results in an perfect outcome.
So, the problem lays in the tag. ==> any solutions?

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:template match="/">
==> RESULT of xsl Transform is OK
<xsl:for-each select="rapporten/rapport">
<xsl:variable name="tmpTotal">
<xsl:for-each select="vakken/vak">
<xsl:value-of select="puntenDW div 100 * tebehalenDW"/>
<xsl:value-of select="tebehalenDW"/>
<xsl:variable name="totpuntenDW">
<xsl:value-of select="sum(msxsl:node-set($tmpTotal)/puntenDW)"/>
<xsl:variable name="tottebehalenDW">
<xsl:value-of select="sum(msxsl:node-set($tmpTotal)/tebehalenDW)"/>
totaal:<xsl:value-of select="$totpuntenDW div $tottebehalenDW * 100"/>

The tag <Pdf xmlns="Aspose.Pdf"> has to be replaced by <Pdf>

Do you mean if I repleace <Pdf xmlns="Aspose.Pdf"> to then it works? But in my test it still won't work.