XSL样式表未知格式异常

时间:2015-07-07 08:08:11

标签: c# xml xslt

我是XSL的新手并试图将以前用于java应用程序的xsl样式表“移植”到C#(应用程序本身是来自旧Java应用程序的端口,因此将在最终生成相同的数据PDF是我正在开发的服务的目标。尝试调用REST服务时出现以下错误:

http://imgur.com/edit

加载xsl文件时发生异常:

    [MethodImpl(MethodImplOptions.Synchronized)]
    public static void MakePdf(XmlDocument xslFoDocument, Stream outputStream)
    {
        FonetDriver driver = PdfPrinterDriver.InitFonetDriver();
        driver.Render(xslFoDocument, outputStream);
    }

此时它引用的代码(我得到了很多错误,但这是我坚持使用的那个),好像我的应用程序无法识别w3.org/2000/svg。 / p>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"  exclude-result-prefixes="">

http://pastebin.com/g26hKR3q

任何知道可能导致这种情况的原因以及如何解决这个问题的人都会知道吗?

我正在使用FO.NET库。

编辑:完成问题的Stacktrace:

System.SystemException was unhandled by user code
HResult=-2146233087
Message=System.SystemException: Unknown formatting object http://www.w3.org/2000/svg^svg
at Fonet.FonetDriver.FireFonetError(String message)
at Fonet.Fo.FOTreeBuilder.StartElement(String uri, String localName, Attributes attlist)
at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader)
Source=Fonet
StackTrace:
   at Fonet.FonetDriver.FireFonetError(String message)
   at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader)
   at Fonet.FonetDriver.Render(XmlReader inputReader, Stream outputStream)
   at Fonet.FonetDriver.Render(TextReader inputReader, Stream outputStream)
   at Fonet.FonetDriver.Render(XmlDocument doc, Stream outputStream)
   at MyRESTService.PdfPrinterDriver.MakePdf(XmlDocument xslFoDocument, Stream outputStream) in c:\Users\Jonathan Lind\Documents\Visual Studio 2013\Projects\MyRESTService\MyRESTService\PdfPrinterDriver.cs:line 61
   at MyRESTService.PdfPrinterDriver.MakePdf(XmlDocument xslFoDocument, String outputFileAbsolutePath) in c:\Users\Jonathan Lind\Documents\Visual Studio 2013\Projects\MyRESTService\MyRESTService\PdfPrinterDriver.cs:line 50
   at MyRESTService.ProductRESTService.GetPDFList(String apiquery, String template) in c:\Users\Jonathan Lind\Documents\Visual Studio 2013\Projects\MyRESTService\MyRESTService\ProductRESTService.svc.cs:line 95
   at SyncInvokeGetPDFList(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
InnerException: 

1 个答案:

答案 0 :(得分:0)

SVG是一种W3C推荐,一种描述矢量图形的XML格式。我认为Apache Fop与Java世界中的Apache Batik一起工作,允许您在最终的PDF中插入矢量图形的光栅化。您使用的.NET FOP处理器似乎不知道如何处理SVG图形。

相关问题