Monday, 8 December 2014

Document('') function errors when calling the .NET Transform method



I have a xslt file that contains a xsl variable that I am using like a lookup table.



<xsl:variable name="TestLookup">
<lookup code="A" means="Test A"/>
<lookup code="B" means="Test B"/>
<lookup code="C" means="Test C"/>
</xsl:variable>


Then I call it like this.



<xsl:value-of select="document('')/*/xsl:variable[@name='TestLookup']/lookup[@code=current()]/@means"/>


When I call the Transform method in .NET I get the following errors:



An error occurred while loading document ''
This operation is not supported for a relative URI.


Basically it is telling me that it can't find the document.

I need some way of creating a lookup table in the xslt file and be able to call it with the Transform command in .NET.



This article had the same problem but I didn't see an answer. Something about p/2 function?

It also listed the node-set() but I can't find any good article on using node-set as a lookup table.

using document() function in .NET XSLT generates error


No comments:

Post a Comment