I have to transform some XMLs with XSLT. The XSLT commands look like this for example:
<Transformation>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:my-scripts">
<msxsl:script language="C#" implements-prefix="user">
<msxsl:using namespace="System.IO" />
<![CDATA[
#region Custom-Code
public static string FileExists(string path)
{
FileInfo fi = new FileInfo(path);
return (fi.Exists && (fi.Length >0)).ToString();
}
#endregion
]]>
</msxsl:script>
<xsl:output method="xml" indent="no" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="Attachement">
<xsl:choose>
<xsl:when test="@mimetype='XPS'">
<xsl:if test="(@type='MANUAL') and (@print='true') and (user:FileExists(File)='True')">
<xsl:copy-of select="." />
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
</Transformation>
As you can see there is some C# code included.
Now my problem:
I am writing a Java application. Of course the standard Java classes are not able to process the C# code.
I found this tool from Microsoft:
http://www.microsoft.com/en-us/download/details.aspx?id=21714
I thougt this should work but you need MSXML 4.0 to run this utility.
It is not a problem for myself but I'm developing this application for a company and it would be great if there is a tool which does not have any dependencies.
Another problem is that I read somewhere, that this utility is not able to process this c# code too but I am not sure if they used version 1 or 2 of it.
Only XSLT 1.0 transformation are required, but if possible I would choose a tool that supports XSLT 2.0