Hi there,
I'm working with Dynamics NAV for more than two years now, but I'm quite new to using webservices and XML/XSL.
For a customer (using Dynamics NAV 2017) I have to create a function that creates a XML-file and apply a XSL-StyleSheet to it.
I searched the internet for a clue how to figure this out. I found several posts on forums, so I had some ideas.
The XML-file is like:
I created the code below:
The pXMLDocument-variable has been created in another function and contains the XML-file.
The code works until "lvNetXslCompiledTransform.Transform(lvNetXMLReaderSource, lvNetXMLWriter);"
Then it generates the following error:
The lvNetMemoryStreamSource is not empty.
Can someone please tell and explain me what's wrong with my code?
Answers
P.S.: post text instead of screenshot so it can be copy+pasted for creating a test.
P.P.S.: does you XML transform correct with the given XSL using a tool like XML notepad or something?
Thanks for your reply!
Do you mean I should not close the XMLWriter? If I don't, the following error arises:
Ad. P.S. Thanks for your advice; should I post the code in text now?
Ad. P.P.S I do not know that tool. I will search for it on the internet.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
lvNetMemoryStreamSource.Flush();
lvNetMemoryStreamSource.Position := 0;
Credits to Renger for giving me the solution!