error message The URI does not identify an external Java class
-
27-09-2019 - |
문제
I am new to XSL, and thus new to using scripts within the XSL.
I have taken example code (also using C#) and adapted it for my own use.. but it does not work.
EDIT: This code works in Visual Studio.. The error is only generated in Oxygen... I am still wanting to have it error free in Oxygen, so any insight is appreciated!
The error message is: The URI urn:cs-scripts does not identify an external Java class
The relevant code I have is:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
xmlns:tok="urn:cs-scripts">
...
...
...
</xsl:template>
<xsl:variable name="temp">
<xsl:value-of select="tok:getList('AAA BBB CCC', ' ')"/>
</xsl:variable>
<msxsl:script language="C#" implements-prefix="tok">
<![CDATA[
public string[] getList(string str, char[] delim)
{
return str.Split(delim, StringSplitOptions.None);
}
public string getString(string[] list, int i)
{
return list[i];
}
]]>
</msxsl:script>
</xsl:stylesheet>
해결책
The declaration
xmlns:tok="urn:cs-script"
refers to a function created in C# within your XSLT. Oxygen is created in java, and thus cannot load/compile the C# generated callback function.
If you want to remove the error in Oxygen, then remove the C# specific callback function (which only will work in a .Net environment).
다른 팁
You don't need an extension function for splitting a string into words.
Just use the FXSL 1.x template str-split-to-words
as described here.
Because FXSL is written in XSLT, it works with any XSLT 2.0 processors and for XSLT 1.x -- with MSXML or any processor that supports the EXSLT node-set()
extension (also supported by XslCompiledTransform
in .NET).