XslCompiledTransform转换方法不起作用

时间:2015-06-17 14:59:04

标签: c# xml xslt transform

我有一个xslt以下的文件。

set.seed(1);
N <- 30;
df <- data.frame(activity=sample(c('Resting','Feeding','Walking','Sleeping'),N,replace=T),lat=runif(N,0,100),long=runif(N,0,100));
cols <- c(Resting='red',Feeding='blue',Walking='green',Sleeping='yellow');
par(mar=c(5,4,4,6)+0.1,xaxs='i',yaxs='i');
plot(df$lat,df$long,xlim=c(0,100),ylim=c(0,100),col=cols[as.character(df$activity)],main='Activity Locations',xlab='Latitude',ylab='Longitude');
legend(103,80,names(cols),col=cols,pch=1,xpd=T);

这是XML源

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
    xmlns:fn="http://www.w3.org/2005/xpath-functions" 
    xmlns:gl-bus="http://www.xbrl.org/int/gl/bus/2006-10-25" 
    xmlns:gl-cor="http://www.xbrl.org/int/gl/cor/2006-10-25" 
    xmlns:gl-gen="http://www.xbrl.org/int/gl/gen/2006-10-25" 
    xmlns:iso4217="http://www.xbrl.org/2003/iso4217" 
    xmlns:link="http://www.xbrl.org/2003/linkbase" 
    xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" 
    xmlns:xbrli="http://www.xbrl.org/2003/instance" 
    xmlns:xl="http://www.xbrl.org/2003/XLink" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:edefter="http://www.edefter.gov.tr">

    <xsl:output version="4.0" method="html" indent="no" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
    <xsl:decimal-format name="tryFormat" grouping-separator="." decimal-separator=","/>
    <xsl:variable name="VKN_TCKN" select="/edefter:defter/xbrli:xbrl[1]/xbrli:context[1]/xbrli:entity[1]"></xsl:variable>

    <xsl:template match="/edefter:defter">
        <html>
            <head>
                <meta http-equiv="X-UA-Compatible" content="IE=7"/>
                <style type="text/css">
                    body.bodyClass{
                        font-family:Arial; 
                        font-size:12px; 
                    }
                    table.tablo1{
                        border-collapse:collapse; 
                        empty-cells:show; 
                        width:100%;
                        border-width:0px;
                    }
                    table.tablo1 thead tr th{
                        background-color:gray; 
                        border:solid 1px Black; 
                        color:white; 
                        font-weight:bold;
                        padding:3px;
                    }

                    table.entryHeader thead tr th{
                        background-color:#e1e1e1; 
                        border:solid 1px Black; 
                        color:black; 
                        padding:3px;
                    }
                    table.entryHeader {
                        border-collapse:collapse; 
                        empty-cells:show; 
                        width:100%;
                        border-width:0px;
                    }
                    table.entryHeader tbody tr td{
                        border:solid 1px Black; 
                        text-align:right;
                        padding:3px;
                    }
                    table.entryHeader tfoot tr td{
                        text-align:right;
                        padding:3px;
                    }

                </style>
            </head>
            <body class="bodyClass">
                <xsl:apply-templates select="xbrli:xbrl" />
            </body>
        </html>
    </xsl:template>

    <xsl:template match="xbrli:xbrl">
        <xsl:apply-templates select="gl-cor:accountingEntries"/>
    </xsl:template>

    <xsl:template match="gl-cor:accountingEntries">
        <xsl:apply-templates select="gl-cor:entityInformation"/>
        <xsl:apply-templates select="gl-cor:documentInfo"/>
        <xsl:call-template name="baslikYaz"/>
        <xsl:apply-templates select="gl-cor:entryHeader"/>
        <xsl:call-template name="genelToplamYaz"/>
    </xsl:template>

    <xsl:template match="gl-cor:entityInformation">
        <table style="font-style:normal; width:100%; " border="0" width="100%">
            <tbody style="font-style:normal; margin:0; ">


    <xsl:variable name="UNVAN" select="gl-bus:organizationIdentifiers[gl-bus:organizationDescription = 'Kurum Unvanı' ]/gl-bus:organizationIdentifier"/>
    <xsl:variable name="AD_SOYAD" select="gl-bus:organizationIdentifiers[gl-bus:organizationDescription = 'Adı Soyadı' ]/gl-bus:organizationIdentifier"/>
    <xsl:variable name="SUBE_ADI" select="gl-bus:organizationIdentifiers[gl-bus:organizationDescription = 'Şube Adı' ]/gl-bus:organizationIdentifier" />




                <tr style="font-style:normal; height:0.48in; ">
                    <td style="text-align:left; width:9.23in; ">
                        <span style="font-weight:bold; ">
                        <xsl:if test="$UNVAN != '' ">                       
                            <xsl:text>Kurum Unvanı : </xsl:text>
                            <xsl:value-of select="gl-bus:organizationIdentifiers[gl-bus:organizationDescription = 'Kurum Unvanı' ]/gl-bus:organizationIdentifier" />
                            </xsl:if>
                            <xsl:if test="$AD_SOYAD != '' ">
                                <xsl:text>Adı Soyadı : </xsl:text>
                            <xsl:value-of select="gl-bus:organizationIdentifiers[gl-bus:organizationDescription = 'Adı Soyadı' ]/gl-bus:organizationIdentifier" />
                            </xsl:if>

                        </span>
                    </td>

                    <td style="text-align:right; width:9.23in; ">
                        <span style="font-size:16px; font-weight:bold; ">
                            <xsl:text>BÜYÜK DEFTER</xsl:text>
                        </span>
                    </td>
                </tr>

                <xsl:if test="$SUBE_ADI != '' ">
                <tr style="font-style:normal; height:0.48in; ">
                    <td style="text-align:left; width:9.23in; ">
                        <span style="font-weight:bold; ">
                            <xsl:text>Şube Adı : </xsl:text>
                            <xsl:value-of select="gl-bus:organizationIdentifiers[gl-bus:organizationDescription = 'Şube Adı' ]/gl-bus:organizationIdentifier" />
                        </span>
                    </td>
                </tr>
                    </xsl:if>
                <tr style="font-style:normal; height:0.48in; ">
                    <td style="text-align:left; width:9.23in; ">                                
                        <span style="font-weight:bold; ">
                     <xsl:if test="$UNVAN != '' ">
                                <xsl:text>Vergi No: </xsl:text>
                                 </xsl:if>
                                 <xsl:if test="$AD_SOYAD != '' ">
                                 <xsl:text>TC Kimlik No: </xsl:text>
                                 </xsl:if>
                                 <xsl:value-of select="$VKN_TCKN"/>


                        </span>                             
                    </td>
                </tr>               
            </tbody>
        </table>
        <br/>
    </xsl:template>

    <xsl:template match="gl-cor:documentInfo">
        <table style="width:100%; " border="0">
            <tbody>
                <tr>
                    <td style="text-align:center; width:auto; ">
                        <xsl:value-of select="gl-cor:entriesComment"/>
                    </td>
                </tr>
            </tbody>
        </table>
    </xsl:template>

    <xsl:template name="baslikYaz">
        <table class="tablo1">
            <thead>
                <tr>
                    <th align="center" width="79">
                        <xsl:text>Yev. Tarih</xsl:text>
                    </th>
                    <th align="center" width="50">
                        <xsl:text>Yev. No.</xsl:text>                       
                    </th>
                    <th width="60">
                        <xsl:text>Hesap Kodu</xsl:text>                     
                    </th>
                    <th width="150">
                        <xsl:text>Hesap Adı</xsl:text>                      
                    </th>
                    <th width="60">
                        <xsl:text>M. Fiş No.</xsl:text>                     
                    </th>
                    <th >
                        <xsl:text>Açıklama</xsl:text>                       
                    </th>
                    <th width="70">
                        <xsl:text>Borç</xsl:text>                       
                    </th>
                    <th width="70">
                        <xsl:text>Alacak</xsl:text>                     
                    </th>
                    <th colspan="2" width="146">
                        <xsl:text>Bakiye</xsl:text>                     
                    </th>
                </tr>
                <tr>
                    <th align="center" width="79"/>
                    <th align="center" width="50"/>
                    <th width="60"/>
                    <th width="150"/>
                    <th width="60"/>
                    <th />
                    <th width="70"/>
                    <th width="70"/>
                    <th width="73">
                        <xsl:text>Borç</xsl:text>                       
                    </th>
                    <th width="73">
                        <xsl:text>Alacak</xsl:text>                     
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="9" style="padding:0px; " align="center" width="79"/>
                </tr>
            </tbody>
        </table>
    </xsl:template>

    <xsl:template match="gl-cor:entryHeader">
        <table class="entryHeader">
            <xsl:call-template name="entryHeaderBaslikYaz">
                <xsl:with-param name="mainId"><xsl:value-of select="gl-cor:entryDetail[1]/gl-cor:account[1]/gl-cor:accountMainID[1]"/></xsl:with-param>
                <xsl:with-param name="mainIdDesc"><xsl:value-of select="gl-cor:entryDetail[1]/gl-cor:account[1]/gl-cor:accountMainDescription[1]"/></xsl:with-param>
            </xsl:call-template>
            <tbody>
                <xsl:call-template name="satirlariYaz">
                    <xsl:with-param name="kumulatifDebit">0</xsl:with-param>
                    <xsl:with-param name="kumulatifCredit">0</xsl:with-param>
                    <xsl:with-param name="entryDetail" select="gl-cor:entryDetail[1]"/>
                </xsl:call-template>
            </tbody>
            <xsl:call-template name="entryHeaderSonyaz">
                <xsl:with-param name="totalDebit"><xsl:value-of select="gl-bus:totalDebit"/></xsl:with-param>
                <xsl:with-param name="totalCredit"><xsl:value-of select="gl-bus:totalCredit"/></xsl:with-param>
            </xsl:call-template>
        </table>
    </xsl:template>

    <xsl:template name="entryHeaderBaslikYaz"> 
        <xsl:param name="mainId"/>
        <xsl:param name="mainIdDesc"/>
        <thead>
            <tr>
                <th align="center" width="79">
                    <xsl:text>&#160;</xsl:text>
                </th>
                <th align="right" width="50">
                    <xsl:text>&#160;</xsl:text>             
                </th>
                <th width="60">
                    <xsl:value-of select="$mainId"/>                    
                </th>
                <th width="150">
                    <xsl:value-of select="$mainIdDesc"/>
                </th>
                <th width="60">
                    <xsl:text>&#160;</xsl:text>                 
                </th>
                <th>
                    <xsl:text>&#160;</xsl:text>
                </th>
                <th width="70">
                    <xsl:text>&#160;</xsl:text>
                </th>
                <th width="70">
                    <xsl:text>&#160;</xsl:text>                 
                </th>
                <th style="font-weight:bold; " width="73">
                    <xsl:text>&#160;</xsl:text>
                </th>
                <th style="font-weight:bold; " width="73">
                </th>
            </tr>
        </thead>
    </xsl:template>

    <xsl:template name="satirlariYaz">
        <xsl:param name="kumulatifDebit"/>
        <xsl:param name="kumulatifCredit"/>
        <xsl:param name="entryDetail"/>

        <xsl:variable name="debit" >
            <xsl:choose>
                <xsl:when test="$entryDetail/gl-cor:debitCreditCode = 'D' or $entryDetail/gl-cor:debitCreditCode = 'debit'">
                    <xsl:value-of select="normalize-space($entryDetail/gl-cor:amount)"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>0</xsl:text>
                </xsl:otherwise>
            </xsl:choose>           
        </xsl:variable>

        <xsl:variable name="credit" >
            <xsl:choose>
                <xsl:when test="$entryDetail/gl-cor:debitCreditCode = 'C' or $entryDetail/gl-cor:debitCreditCode = 'credit'">
                    <xsl:value-of select="normalize-space($entryDetail/gl-cor:amount)"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>0</xsl:text>
                </xsl:otherwise>
            </xsl:choose>           
        </xsl:variable>

        <tr>
            <td style="text-align:center;">
                <xsl:call-template name="convertDate">
                    <xsl:with-param name="postingDate" select="$entryDetail/gl-cor:postingDate"/>
                </xsl:call-template>
            </td>
            <td>
                <xsl:value-of select="$entryDetail/gl-cor:lineNumberCounter"/>
            </td>
            <td style="text-align:left;">
                <xsl:value-of select="$entryDetail/gl-cor:account[1]/gl-cor:accountSub[1]/gl-cor:accountSubID[1]"/>
            </td>
            <td style="text-align:left;">
                <xsl:value-of select="$entryDetail/gl-cor:account[1]/gl-cor:accountSub[1]/gl-cor:accountSubDescription[1]"/>
            </td>
            <td style="text-align:left;">
                <xsl:value-of select="$entryDetail/gl-cor:documentReference"/>
            </td>
            <td style="text-align:left;">
                <xsl:value-of select="$entryDetail/gl-cor:detailComment"/>
            </td>
            <td>
                <xsl:text>&#160;</xsl:text>
                <xsl:value-of select="format-number(number($debit), '###.##0,00', 'tryFormat')" />
            </td>
            <td>
                <xsl:text>&#160;</xsl:text>
                <xsl:value-of select="format-number(number($credit), '###.##0,00', 'tryFormat')" />
            </td>
            <td style="font-weight:bold;">
                <xsl:text>&#160;</xsl:text>
                <xsl:value-of select="format-number(number($debit+$kumulatifDebit), '###.##0,00', 'tryFormat')" />
            </td>
            <td style="font-weight:bold;">
                <xsl:text>&#160;</xsl:text>
                <xsl:value-of select="format-number(number($credit+$kumulatifCredit), '###.##0,00', 'tryFormat')" />
            </td>
        </tr>

        <xsl:variable name="nextNode" select="$entryDetail/following-sibling::node()[local-name()=local-name($entryDetail)][1]"></xsl:variable>
        <xsl:choose>
            <xsl:when test="$nextNode">
                <xsl:call-template name="satirlariYaz">
                    <xsl:with-param name="kumulatifDebit"><xsl:value-of select="$debit + $kumulatifDebit"/></xsl:with-param>
                    <xsl:with-param name="kumulatifCredit"><xsl:value-of select="$credit + $kumulatifCredit"/></xsl:with-param>
                    <xsl:with-param name="entryDetail" select="$nextNode"/>
                </xsl:call-template>
            </xsl:when>
        </xsl:choose>

    </xsl:template> 

    <xsl:template name="entryHeaderSonyaz">

        <xsl:param name="totalDebit"/>
        <xsl:param name="totalCredit"/>

        <xsl:variable name="headerDebit">
            <xsl:value-of select="sum(gl-cor:entryDetail[gl-cor:debitCreditCode = 'D' or gl-cor:debitCreditCode = 'debit']/gl-cor:amount)"/>
        </xsl:variable>

        <xsl:variable name="headerCredit">
            <xsl:value-of select="sum(gl-cor:entryDetail[gl-cor:debitCreditCode = 'C' or gl-cor:debitCreditCode = 'credit']/gl-cor:amount)"/>   
        </xsl:variable>

        <tfoot>
            <tr>        
                <td colspan="5"/>
                <td style="font-weight:bold; ">
                    <xsl:text>TOPLAM : </xsl:text>
                </td>
                <td>
                    <xsl:value-of select="format-number(number($headerDebit), '###.##0,00', 'tryFormat')" />
                </td>
                <td>
                    <xsl:value-of select="format-number(number($headerCredit), '###.##0,00', 'tryFormat')" />   
                </td>
                <td style="font-weight:bold;">
                    <xsl:value-of select="format-number(number($totalDebit), '###.##0,00', 'tryFormat')" />
                </td>               
                <td style="font-weight:bold;">
                    <xsl:value-of select="format-number(number($totalCredit), '###.##0,00', 'tryFormat')" />
                </td>               
            </tr>
        </tfoot>

    </xsl:template>

    <xsl:template name="genelToplamYaz">

        <xsl:variable name="toplamBorc" select="sum(gl-cor:entryHeader/gl-cor:entryDetail[gl-cor:debitCreditCode = 'D' or gl-cor:debitCreditCode = 'debit']/gl-cor:amount)"/>
        <xsl:variable name="toplamAlacak" select="sum(gl-cor:entryHeader/gl-cor:entryDetail[gl-cor:debitCreditCode = 'C' or gl-cor:debitCreditCode = 'credit']/gl-cor:amount)"/>

        <xsl:variable name="borcFark">
            <xsl:choose>
                <xsl:when test="$toplamBorc > $toplamAlacak">
                    <xsl:value-of select="number($toplamBorc - $toplamAlacak)"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="number(0)"/>
                </xsl:otherwise>
            </xsl:choose>           
        </xsl:variable>

        <xsl:variable name="alacakFark">
            <xsl:choose>
                <xsl:when test="$toplamAlacak > $toplamBorc">
                    <xsl:value-of select="number($toplamAlacak - $toplamBorc)"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="number(0)"/>
                </xsl:otherwise>
            </xsl:choose>           
        </xsl:variable>     

        <table style="border-collapse:collapse; empty-cells:show; width:100%; " border="0" cellpadding="3" cellspacing="0">
            <tbody>
                <tr>                    
                    <td style="border:solid 1px Black; border-right-color:white; padding:0px; " align="center" width="86"/>
                    <td style="border:solid 1px Black; border-right-color:white; padding:0px; " align="right" width="56"/>
                    <td style="border:solid 1px Black; border-right-color:white; padding:0px; " width="66"/>
                    <td style="border:solid 1px Black; border-right-color:white; padding:0px; " width="156"/>
                    <td style="border:solid 1px Black; border-right-color:white; padding:0px; " width="66"/>
                    <td style="border:solid 1px Black; padding:0px; text-align:right; ">
                        <xsl:text>GENEL TOPLAM :&#160; </xsl:text>                      
                    </td>
                    <td style="border:solid 1px Black; padding:3px; text-align:right; " width="70">
                        <xsl:value-of select="format-number($toplamBorc, '###.##0,00', 'tryFormat')"/>                      
                    </td>
                    <td style="border:solid 1px Black; padding:3px; text-align:right; " width="70">
                        <xsl:value-of select="format-number($toplamAlacak, '###.##0,00', 'tryFormat')"/>
                    </td>
                    <td style="border:solid 1px Black; padding:3px; text-align:right; " width="73">
                        <xsl:value-of select="format-number($borcFark, '###.##0,00', 'tryFormat')"/>
                    </td>                   
                    <td style="border:solid 1px Black; padding:3px; text-align:right; " width="73">
                        <xsl:value-of select="format-number($alacakFark, '###.##0,00', 'tryFormat')"/>
                    </td>                   

                </tr>
            </tbody>
        </table>

    </xsl:template>

    <xsl:template name="convertDate">
        <xsl:param name="postingDate"/>
        <xsl:value-of select="concat(substring($postingDate,9,2),'/', substring($postingDate, 6,2), '/', substring($postingDate,1,4))"/>
    </xsl:template>

</xsl:stylesheet>

我正在使用该代码段。

下面的代码根据inputXml和xslt字符串数据生成html字符串。

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="kebir.xslt"?><edefter:defter xmlns:edefter="http://www.edefter.gov.tr" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.edefter.gov.tr ../xsd/edefter.xsd">
    <xbrli:xbrl xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:iso639="http://www.xbrl.org/2005/iso639" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:gl-bus="http://www.xbrl.org/int/gl/bus/2006-10-25" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gl-cor="http://www.xbrl.org/int/gl/cor/2006-10-25" xmlns:gl-plt="http://www.xbrl.org/int/gl/plt/2006-10-25" xmlns:iso4217="http://www.xbrl.org/2003/iso4217">
        <link:schemaRef xlink:href="../xsd/2006-10-25/plt/case-c-b/gl-plt-2006-10-25.xsd" xlink:type="simple"/>
        <xbrli:context id="ledger_context">
            <xbrli:entity>
                <xbrli:identifier scheme="http://www.gib.gov.tr">1111111111</xbrli:identifier>
            </xbrli:entity>
            <xbrli:period>
                <xbrli:instant>2015-05-20</xbrli:instant>
            </xbrli:period>
        </xbrli:context>
        <xbrli:unit id="try">
            <xbrli:measure>iso4217:TRY</xbrli:measure>
        </xbrli:unit>
        <xbrli:unit id="countable">
            <xbrli:measure>xbrli:pure</xbrli:measure>
        </xbrli:unit>
        <gl-cor:accountingEntries>
            <gl-cor:documentInfo>
                <gl-cor:entriesType contextRef="ledger_context">ledger</gl-cor:entriesType>
                <gl-cor:uniqueID contextRef="ledger_context">KEB201501000001</gl-cor:uniqueID>
                <gl-cor:language contextRef="ledger_context">iso639:tr</gl-cor:language>
                <gl-cor:creationDate contextRef="ledger_context">2015-05-20</gl-cor:creationDate>
                <gl-bus:creator contextRef="ledger_context"></gl-bus:creator>
                <gl-cor:entriesComment contextRef="ledger_context">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</gl-cor:entriesComment>
                <gl-cor:periodCoveredStart contextRef="ledger_context">2015-01-01</gl-cor:periodCoveredStart>
                <gl-cor:periodCoveredEnd contextRef="ledger_context">2015-01-01</gl-cor:periodCoveredEnd>
                <gl-bus:sourceApplication contextRef="ledger_context">XXXXXXXXXXXXXXXXXXXXXXXXXXXX</gl-bus:sourceApplication>
            </gl-cor:documentInfo>
            <gl-cor:entityInformation>
                <gl-bus:entityPhoneNumber>
                    <gl-bus:phoneNumberDescription contextRef="ledger_context">switchboard</gl-bus:phoneNumberDescription>
                    <gl-bus:phoneNumber contextRef="ledger_context">1111111111</gl-bus:phoneNumber>
                </gl-bus:entityPhoneNumber>
                <gl-bus:entityFaxNumberStructure>
                    <gl-bus:entityFaxNumber contextRef="ledger_context">1111111111</gl-bus:entityFaxNumber>
                </gl-bus:entityFaxNumberStructure>
                <gl-bus:entityEmailAddressStructure>
                    <gl-bus:entityEmailAddress contextRef="ledger_context">xxxxxx@xxxxxxx.com.tr</gl-bus:entityEmailAddress>
                </gl-bus:entityEmailAddressStructure>
                <gl-bus:organizationIdentifiers>
                    <gl-bus:organizationIdentifier contextRef="ledger_context">XXXXXXXXXXXXXXXXXXXXXXXXXXXX.</gl-bus:organizationIdentifier>
                    <gl-bus:organizationDescription contextRef="ledger_context">Kurum Unvanı</gl-bus:organizationDescription>
                </gl-bus:organizationIdentifiers>
                <gl-bus:organizationAddress>
                    <gl-bus:organizationBuildingNumber contextRef="ledger_context">10</gl-bus:organizationBuildingNumber>
                    <gl-bus:organizationAddressStreet contextRef="ledger_context">XXXXXXXXXXXXXXXXX</gl-bus:organizationAddressStreet>
                    <gl-bus:organizationAddressStreet2 contextRef="ledger_context">XXXXXXXXXX</gl-bus:organizationAddressStreet2>
                    <gl-bus:organizationAddressCity contextRef="ledger_context">XXXXXXXXXXX</gl-bus:organizationAddressCity>
                    <gl-bus:organizationAddressZipOrPostalCode contextRef="ledger_context">34510</gl-bus:organizationAddressZipOrPostalCode>
                    <gl-bus:organizationAddressCountry contextRef="ledger_context">TÜRKİYE</gl-bus:organizationAddressCountry>
                </gl-bus:organizationAddress>
                <gl-bus:entityWebSite>
                    <gl-bus:webSiteURL contextRef="ledger_context">www.xxxxxxxxxxxx.com.tr</gl-bus:webSiteURL>
                </gl-bus:entityWebSite>
                <gl-bus:businessDescription contextRef="ledger_context">35.13.01</gl-bus:businessDescription>
                <gl-bus:fiscalYearStart contextRef="ledger_context">2015-01-01</gl-bus:fiscalYearStart>
                <gl-bus:fiscalYearEnd contextRef="ledger_context">2015-12-31</gl-bus:fiscalYearEnd>
                <gl-bus:accountantInformation>
                    <gl-bus:accountantName contextRef="ledger_context">XXXXXXXXXXXX LTD. ŞTİ.</gl-bus:accountantName>
                    <gl-bus:accountantAddress>
                        <gl-bus:accountantBuildingNumber contextRef="ledger_context">10</gl-bus:accountantBuildingNumber>
                        <gl-bus:accountantStreet contextRef="ledger_context">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.</gl-bus:accountantStreet>
                        <gl-bus:accountantAddressStreet2 contextRef="ledger_context">XXXXXXXXXXXXXXXXXXXXXXXXX</gl-bus:accountantAddressStreet2>
                        <gl-bus:accountantCity contextRef="ledger_context">İSTANBUL</gl-bus:accountantCity>
                        <gl-bus:accountantCountry contextRef="ledger_context">TÜRKİYE</gl-bus:accountantCountry>
                        <gl-bus:accountantZipOrPostalCode contextRef="ledger_context">34510</gl-bus:accountantZipOrPostalCode>
                    </gl-bus:accountantAddress>
                    <gl-bus:accountantEngagementTypeDescription contextRef="ledger_context">YMM Sözleşmesi,2014-01-31,331174</gl-bus:accountantEngagementTypeDescription>
                    <gl-bus:accountantContactInformation>
                        <gl-bus:accountantContactPhone>
                            <gl-bus:accountantContactPhoneNumberDescription contextRef="ledger_context">switchboard</gl-bus:accountantContactPhoneNumberDescription>
                            <gl-bus:accountantContactPhoneNumber contextRef="ledger_context">1111111111</gl-bus:accountantContactPhoneNumber>
                        </gl-bus:accountantContactPhone>
                        <gl-bus:accountantContactFax>
                            <gl-bus:accountantContactFaxNumber contextRef="ledger_context">1111111111</gl-bus:accountantContactFaxNumber>
                        </gl-bus:accountantContactFax>
                        <gl-bus:accountantContactEmail>
                            <gl-bus:accountantContactEmailAddress contextRef="ledger_context">xxxx@xxxx.com.tr</gl-bus:accountantContactEmailAddress>
                        </gl-bus:accountantContactEmail>
                    </gl-bus:accountantContactInformation>
                </gl-bus:accountantInformation>
            </gl-cor:entityInformation>
            <gl-cor:entryHeader>
                <gl-bus:totalDebit contextRef="ledger_context" decimals="INF" unitRef="try">3258.52</gl-bus:totalDebit>
                <gl-bus:totalCredit contextRef="ledger_context" decimals="INF" unitRef="try">0</gl-bus:totalCredit>
                <gl-cor:entryDetail>
                    <gl-cor:lineNumber contextRef="ledger_context">437</gl-cor:lineNumber>
                    <gl-cor:lineNumberCounter contextRef="ledger_context" decimals="INF" unitRef="countable">219</gl-cor:lineNumberCounter>
                    <gl-cor:account>
                        <gl-cor:accountMainID contextRef="ledger_context">100</gl-cor:accountMainID>
                        <gl-cor:accountMainDescription contextRef="ledger_context">KASA</gl-cor:accountMainDescription>
                        <gl-cor:accountSub>
                            <gl-cor:accountSubDescription contextRef="ledger_context">TL KASA HESABI</gl-cor:accountSubDescription>
                            <gl-cor:accountSubID contextRef="ledger_context">100 0000100</gl-cor:accountSubID>
                        </gl-cor:accountSub>
                    </gl-cor:account>
                    <gl-cor:amount contextRef="ledger_context" decimals="INF" unitRef="try">3258.52</gl-cor:amount>
                    <gl-cor:debitCreditCode contextRef="ledger_context">D</gl-cor:debitCreditCode>
                    <gl-cor:postingDate contextRef="ledger_context">2015-01-01</gl-cor:postingDate>
                    <gl-cor:documentType contextRef="ledger_context">other</gl-cor:documentType>
                    <gl-cor:documentTypeDescription contextRef="ledger_context">MUH</gl-cor:documentTypeDescription>
                    <gl-cor:documentNumber contextRef="ledger_context">KAPAT/AÇ</gl-cor:documentNumber>
                    <gl-cor:documentReference contextRef="ledger_context">0001000000</gl-cor:documentReference>
                    <gl-cor:documentDate contextRef="ledger_context">2015-01-01</gl-cor:documentDate>
                    <gl-bus:paymentMethod contextRef="ledger_context">MAHSUP</gl-bus:paymentMethod>
                    <gl-cor:detailComment contextRef="ledger_context">YIL AÇILIŞI-2014 YILI KAPANIŞ AÇILIŞ KAYITLARI</gl-cor:detailComment>
                </gl-cor:entryDetail>
            </gl-cor:entryHeader>
        </gl-cor:accountingEntries>
    </xbrli:xbrl>
</edefter:defter>

当我测试XmlToHtml方法然后崩溃时。

未处理的类型&#39; System.StackOverflowException&#39;发生在mscorlib.dll

StackOverlowException

我不明白这条错误信息。

可以是Xslt String错了吗? (我认为)

有什么想法吗?

感谢。

1 个答案:

答案 0 :(得分:1)

Introducing XslCompiledTransform有用的

// New constructor allows you to debug stylesheets
   public XslCompiledTransform(bool enableDebug); 

解决了我的问题已更改,然后设置enableDebug false。

您也可以查看source

 public static String XmlToHtml(String inputXml, String transformXsl)
    {
        XslCompiledTransform xslTransform = new XslCompiledTransform(false);
        using (StringReader sr = new StringReader(transformXsl))
        {
            using (XmlReader xr = XmlReader.Create(sr))
            {
                xslTransform.Load(xr);
            }
        }
        string result = String.Empty;
        using (StringReader sr = new StringReader(inputXml))
        {
            using (XmlReader xr = XmlReader.Create(sr))
            {
                using (StringWriter sw = new StringWriter())
                {
                    xslTransform.Transform(xr, null, sw);
                    result = sw.ToString();
                }
            }
        }
        return result;
    }