Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ';版本';不能是';转型';要素_C#_Xslt_Xslcompiledtransform - Fatal编程技术网

C# ';版本';不能是';转型';要素

C# ';版本';不能是';转型';要素,c#,xslt,xslcompiledtransform,C#,Xslt,Xslcompiledtransform,我正在使用XslCompiledTransform.Load,每次收到错误消息时: 'version' cannot be a child of the 'Transformation' element 这是样式表: <Transformation><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsof

我正在使用XslCompiledTransform.Load,每次收到错误消息时:

 'version' cannot be a child  of the 'Transformation' element
这是样式表:

<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" 
xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"><xsl:output 
method="xml" /><xsl:template match="node() | @*"><xsl:copy><xsl:apply-templates 
select="@* | node()" /></xsl:copy></xsl:template><xsl:template match="testlist"><xsl:copy>
<xsl:apply-templates select="test"><xsl:sort select="requestor/code" /></xsl:apply-   
templates></xsl:copy></xsl:template></xsl:stylesheet></Transformation>

如果删除该版本,则会出现错误:缺少必需属性“version”
我是否因为使用标记“Transformation”中的样式表而出现错误?

您的问题的答案是“是”。确实会出现错误,因为在
转换
元素中只有
xsl:stylesheet
元素

<Transformation>
   <xsl:stylesheet version="1.0" 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<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" 
  xmlns:exsl="http://exslt.org/common" 
  extension-element-prefixes="exsl">
   <xsl:output method="xml"/>

   <xsl:template match="/">
      <Transformation>
         <xsl:apply-templates select="@* | node()"/>
      </Transformation>
   </xsl:template>

   <xsl:template match="node() | @*">
      <xsl:copy>
         <xsl:apply-templates select="@* | node()"/>
      </xsl:copy>
   </xsl:template>

   <xsl:template match="testlist">
      <xsl:copy>
         <xsl:apply-templates select="test">
            <xsl:sort select="requestor/code"/>
         </xsl:apply-templates>
      </xsl:copy>
   </xsl:template>
 </xsl:stylesheet>