C# 编写XSLT样式表头
我正在构建一个C#应用程序,它将基于预先配置的文件构建XSLT文件 我可以生成XSLT文件,它接近我想要的,但我有几个问题 问题1:C# 编写XSLT样式表头,c#,xslt,xmlwriter,C#,Xslt,Xmlwriter,我正在构建一个C#应用程序,它将基于预先配置的文件构建XSLT文件 我可以生成XSLT文件,它接近我想要的,但我有几个问题 问题1: XSLT文件顶部的样式表标题格式错误。以下是我所期待的: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="1.0"
XSLT文件顶部的样式表标题格式错误。以下是我所期待的:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="1.0" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
第2期:在XSLT文件的一般主体中,有多个位置显示这些“p”声明。在我上面的输出中,一个例子是:
p3:x="urn:schemas-microsoft-com:office:excel"
我想我在某种程度上误判了这个方法,但我不确定如何纠正这一点。似乎这些参数需要改变位置,并以正确的方式使用 参考: 在您的情况下,它应该写为 例如:
xmlWriter.WriteAttributeString("xmlns", "ss", null, "urn:schemas-microsoft-com:office:spreadsheet");
因为写入属性测试环(字符串,字符串,字符串,字符串)
在派生类中重写时,写出具有指定前缀、本地名称、命名空间URI和值的属性
public void WriteAttributeString (string prefix, string localName, string ns, string value);
谢谢你,维比!这就是我问题的解决办法。我真的很感谢你提到微软文档。
xmlWriter.WriteAttributeString("xmlns", "ss", null, "urn:schemas-microsoft-com:office:spreadsheet");
public void WriteAttributeString (string prefix, string localName, string ns, string value);