Developer forum

Forum » Integration » Using document() in XSLT

Using document() in XSLT

Michael Knudsen
Reply

Hello forum,

- I get the error below, when I configure my XML to User Provider, so I wonder if it's possible to use the document() function in my XSLT?

Problem is, I need to merge customer.xml with delivery.xml:
<xsl:variable name="deliveryaddresses" select="document('./delivery.xml')/deliveryaddresses"/>

Error message:

Execution of the 'document()' function was prohibited. Use the XsltSettings.EnableDocumentFunction property to enable it. An error occurred at E:\Solutions\xxx\Files\Files\Integration\Data\XSLT\Customer.xslt(5,2).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.Xsl.XslTransformException: Execution of the 'document()' function was prohibited. Use the XsltSettings.EnableDocumentFunction property to enable it. An error occurred at E:\Solutions\xxx\Files\Files\Integration\Data\XSLT\Customer.xslt(5,2).

Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

Br. Michael Knudsen


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Michael,
looks like a bug in the xml provider. Can you try with this version? Also maybe it is possible to avoid using document and replace it with other functions like here.
BR, Dmitrij

 
Michael Knudsen
Reply

Hello Dmitriy,

- and thanks for the suggestions, but since I don't have a test environment for the DW9.13.11 I don't dare to drop the files on the solution.

I'll try to take a close look at the Stackoverflow solution, even it looks like a reference to the XML document itself with document('').

Br. Michael Knudsen

 
Michael Knudsen
Reply

Update, I have tried to copy my files to a DW9.14.9 solution and it gives the same error as on DW9.13.11, but I haven't used the files you have linked. Don't know if that gives any difference.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Michael,
not is a new one, not yet released, so you can put the dll file in your site bin folder and try if it will work.
BR, Dmitrij

 

You must be logged in to post in the forum