c#

时间:2017-02-22 17:55:52

标签: c# xml visual-studio xslt

使用代码,我收到错误。我正在尝试使用xml和此xsl文件进行转换。请协助/建议。删除了几行以使其更容易。真的试着理解为什么即使我做出改变也会出现这个错误。

Severity    Code    Description Project File    Line    Suppression StateError   Stylesheet must start either with an 'xsl:stylesheet' or an 'xsl:transform' element, or with a literal result element that has an 'xsl:version' attribute, where prefix 'xsl' denotes the 'http://www.w3.org/1999/XSL/Transform' namespace. 

XSLT:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/xsl11/">

<SCRIPT>
    <xsl:comment>
        <![CDATA[
    function sort(field)
    {
      sortField.value = field;
      <!-- set cursor to watch here? -->
      listing.innerHTML = source.documentElement.transformNode(stylesheet);
    }
  ]]>
    </xsl:comment>
</SCRIPT>

<SCRIPT for="window" event="onload">
    <xsl:comment>
        <![CDATA[
    stylesheet = document.XSLDocument;
    source = document.XMLDocument;
    sortField = document.XSLDocument.selectSingleNode("//@order-by");
  ]]>
    </xsl:comment>
</SCRIPT>
<HTML>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"></META>
<BODY>
    <xsl:for-each select="report/titledata">
        <table width="80%" border="0" align="center">
            <tr>
                <td width="50%">
                    <div align="center">
                        <font face="tahoma">
                            <b>
                                <font size="3">
                                    <xsl:if match=".[title=1]">
                                        INCOMING REPORT
                                    </xsl:if>
                                    <xsl:if match=".[title=2]">
                                        OUTGOING REPORT
                                    </xsl:if>
                                </font>
                            </b>
                        </font>
                    </div>
                </td>
                <td width="25%" >
                    <div align="center">
                        <font face="tahoma" size="2">
                            <b>
                                <xsl:value-of select="date"/>
                            </b>
                        </font>
                    </div>
                </td>
                <td width="25%">
                    <div align="center">
                        <font face="tahoma" size="2">
                            <b>
                                <xsl:value-of select="time"/>
                            </b>
                        </font>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:if match=".[subtitle=1]">
                        <div align="center">
                            <font face="tahoma">
                                <b>
                                    <font size="2">FROM CORPORATE CLIENT</font>
                                </b>
                            </font>
                        </div>
                    </xsl:if>
                    <xsl:if match=".[subtitle=2]">
                        <div align="center">
                            <font face="tahoma">
                                <b>
                                    <font size="2">FROM ACH</font>
                                </b>
                            </font>
                        </div>
                    </xsl:if>
                    <xsl:if match=".[subtitle=3]">
                        <div align="center">
                            <font face="tahoma">
                                <b>
                                    <font size="2">TO LOCAL ENTITIES</font>
                                </b>
                            </font>
                        </div>
                    </xsl:if>
                    <xsl:if match=".[subtitle=4]">
                        <div align="center">
                            <font face="tahoma">
                                <b>
                                    <font size="2">TO ACH</font>
                                </b>
                            </font>
                        </div>
                    </xsl:if>
                </td>
            </tr>
        </table>
    </xsl:for-each>
    <br></br>
    <xsl:for-each select="report/file">
        <xsl:if match=".[viewFile=1]">
            <table width="100%" border="0">
                <tr>
                    <td colspan="2">
                        <font face="Tahoma" size="3" color="#000000">
                            <b>File Header Information</b>
                        </font>
                    </td>
                    <td colspan="2">
                        <font face="Tahoma" size="3" color="#000000">
                            <b>File Control Information</b>
                        </font>
                    </td>
                </tr>
                <tr>
                    <td width="16%">
                        <font color="#000000">
                            <b>
                                <font face="Tahoma" size="2">Id:</font>
                            </b>
                        </font>
                    </td>
                    <td width="36%" bgcolor="#FFFFFF">
                        <font face="Tahoma" size="2" color="#000000">
                            <xsl:value-of select="filecons"/>
                        </font>
                    </td>
                    <td width="20%">
                        <font color="#000000">
                            <b>
                                <font face="Tahoma" size="2">Debit Total:</font>
                            </b>
                        </font>
                    </td>
                    <td width="28%"></td>
                </tr>
                <tr>
                    <td width="16%">
                        <font color="#000000">
                            <b>
                                <font face="Tahoma" size="2">Date and Time:</font>
                                            <xsl:value-of select="location"/></table>
    </xsl:for-each>
</BODY>
 </HTML>
 </xsl:stylesheet>

0 个答案:

没有答案