Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: DateFormatting, date is taken from MS SQL

$
0
0
This option is tried, there is an error "Error when calling the extension function "Format". Detailed description of the error, see. In InnerException. - The string "" is not valid AllXsd."
<td><xsl:value-of select="df:Format(ReplDateGood, 'dd MM yyyy')"/></td>
If you do so, there is no error, but the date is repeated again
<td><xsl:value-of select="df:Format($ReplDateGood, 'dd MM yyyy')"/></td>
Here is again a full listing

Template:
<xsl:stylesheet xmlns:df = "#dateExtensions" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:in="http://www.composite.net/ns/transformation/input/1.0" 
    xmlns:lang="http://www.composite.net/ns/localization/1.0" 
    xmlns:f="http://www.composite.net/ns/function/1.0" 
    xmlns="http://www.w3.org/1999/xhtml" 
    exclude-result-prefixes="xsl in lang f">
    <xsl:variable name="ReplDateGood" select="/in:inputs/in:result[@name='ReportBadReplication']/root/NewDataSet/Table/ReplDateGood" />
    <xsl:template match="/">
        <html>
            <head></head>
            <body>
                <table border="1">
                <tr align="center"><td><b>Публикация</b></td><td><b>Подписка</b></td><td><b>Ошибок</b></td><td><b>Последняя успешная</b></td></tr>
                <xsl:apply-templates select="/in:inputs/in:result[@name='ReportBadReplication']/root/NewDataSet/Table"/>
                </table>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="/in:inputs/in:result[@name='ReportBadReplication']/root/NewDataSet/Table">
    <tr>
      <td width="230"><xsl:value-of select="NamePub"/></td>
      <td width="160"><xsl:value-of select="NameSub"/></td>
      <td width="80" align="center"><xsl:value-of select="ReplBad"/></td>
       <td><xsl:value-of select="df:Format($ReplDateGood, 'dd MM yyyy')"/></td>
    </tr>
  </xsl:template>

</xsl:stylesheet>
Input:
<in:inputs xmlns:in="http://www.composite.net/ns/transformation/input/1.0">
    <!-- Function call result 'DateFormatting' has been registered as an Xslt Entension Object. -->
    <!-- Extension methods can be called using the namespace '#dateExtensions'. -->
    <!-- The following methods exist: -->
    <!-- String ns:Now() -->
    <!-- String ns:LongDateFormat(String xmlFormattedDate) -->
    <!-- String ns:LongTimeFormat(String xmlFormattedDate) -->
    <!-- String ns:ShortDateFormat(String xmlFormattedDate) -->
    <!-- String ns:ShortTimeFormat(String xmlFormattedDate) -->
    <!-- Int32 ns:Day(String xmlFormattedDate) -->
    <!-- Int32 ns:Month(String xmlFormattedDate) -->
    <!-- Int32 ns:Year(String xmlFormattedDate) -->
    <!-- String ns:LongMonthName(Int32 monthNumber) -->
    <!-- String ns:ShortMonthName(Int32 monthNumber) -->
    <!-- String ns:Format(String xmlFormattedDate, String DateFormat) -->
    <!-- Function Call Result (2 ms), XPath /in:inputs/in:result[@name='ReportBadReplication']/root  -->
     <in:result name="ReportBadReplication">
         <root xmlns="">
             <NewDataSet>
                 <Table>
                    <ID>8552</ID>
                    <Client>SoftService</Client>
                    <NamePub>RedCup_pub</NamePub>
                    <NameSub>pos3</NameSub>
                    <ReplGood>0</ReplGood>
                    <ReplBad>172</ReplBad>
                    <ReplDateGood>2014-08-31T21:56:00+04:00</ReplDateGood>
                    <ReplDateBad>2014-09-09T14:10:00+04:00</ReplDateBad>
                </Table>
                 <Table>
                    <ID>8664</ID>
                    <Client>SoftService</Client>
                    <NamePub>RedCup_pub</NamePub>
                    <NameSub>unit088</NameSub>
                    <ReplGood>0</ReplGood>
                    <ReplBad>172</ReplBad>
                    <ReplDateGood>2014-08-29T13:55:00+04:00</ReplDateGood>
                    <ReplDateBad>2014-09-09T14:10:00+04:00</ReplDateBad>
                </Table>
                 <Table>
                    <ID>8761</ID>
                    <Client>SoftService</Client>
                    <NamePub>RedCupFrOr_pub</NamePub>
                    <NameSub>слон1</NameSub>
                    <ReplGood>0</ReplGood>
                    <ReplBad>171</ReplBad>
                    <ReplDateGood>2014-09-08T21:20:00+04:00</ReplDateGood>
                    <ReplDateBad>2014-09-09T14:05:00+04:00</ReplDateBad>
                </Table>
                 <Table>
                    <ID>8774</ID>
                    <Client>SoftService</Client>
                    <NamePub>RedCupZCKrasnoyarsk_pub</NamePub>
                    <NameSub>unit139</NameSub>
                    <ReplGood>0</ReplGood>
                    <ReplBad>171</ReplBad>
                    <ReplDateBad>2014-09-09T14:07:00+04:00</ReplDateBad>
                </Table>
                 <Table>
                    <ID>8779</ID>
                    <Client>SoftService</Client>
                    <NamePub>RedCupZUSamara_pub</NamePub>
                    <NameSub>unit136</NameSub>
                    <ReplGood>0</ReplGood>
                    <ReplBad>171</ReplBad>
                    <ReplDateGood>2014-09-08T15:35:00+04:00</ReplDateGood>
                    <ReplDateBad>2014-09-09T14:05:00+04:00</ReplDateBad>
                </Table>
                 <Table>
                    <ID>8781</ID>
                    <Client>SoftService</Client>
                    <NamePub>RedCupZYChelyabinsk-2_pub</NamePub>
                    <NameSub>unit137</NameSub>
                    <ReplGood>0</ReplGood>
                    <ReplBad>171</ReplBad>
                    <ReplDateBad>2014-09-09T14:07:00+04:00</ReplDateBad>
                </Table>
                 <Table>
                    <ID>8784</ID>
                    <Client>SoftService</Client>
                    <NamePub>RedCupZSChelyabinsk_pub</NamePub>
                    <NameSub>unit143</NameSub>
                    <ReplGood>0</ReplGood>
                    <ReplBad>171</ReplBad>
                    <ReplDateBad>2014-09-09T14:07:00+04:00</ReplDateBad>
                </Table>
            </NewDataSet>
        </root>
    </in:result>
</in:inputs>
Result:
<html xmlns="http://www.w3.org/1999/xhtml">
    <head/>
     <body>
         <table border="1">
             <tr align="center">
                 <td>
                    <b>Публикация</b>
                </td>
                 <td>
                    <b>Подписка</b>
                </td>
                 <td>
                    <b>Ошибок</b>
                </td>
                 <td>
                    <b>Последняя успешная</b>
                </td>
            </tr>
             <tr>
                <td width="230">RedCup_pub</td>
                <td width="160">pos3</td>
                <td width="80" align="center">172</td>
                <td>31 08 2014</td>
            </tr>
             <tr>
                <td width="230">RedCup_pub</td>
                <td width="160">unit088</td>
                <td width="80" align="center">172</td>
                <td>31 08 2014</td>
            </tr>
             <tr>
                <td width="230">RedCupFrOr_pub</td>
                <td width="160">слон1</td>
                <td width="80" align="center">171</td>
                <td>31 08 2014</td>
            </tr>
             <tr>
                <td width="230">RedCupZCKrasnoyarsk_pub</td>
                <td width="160">unit139</td>
                <td width="80" align="center">171</td>
                <td>31 08 2014</td>
            </tr>
             <tr>
                <td width="230">RedCupZUSamara_pub</td>
                <td width="160">unit136</td>
                <td width="80" align="center">171</td>
                <td>31 08 2014</td>
            </tr>
             <tr>
                <td width="230">RedCupZYChelyabinsk-2_pub</td>
                <td width="160">unit137</td>
                <td width="80" align="center">171</td>
                <td>31 08 2014</td>
            </tr>
             <tr>
                <td width="230">RedCupZSChelyabinsk_pub</td>
                <td width="160">unit143</td>
                <td width="80" align="center">171</td>
                <td>31 08 2014</td>
            </tr>
        </table>
    </body>
</html>
As can be seen from the "Result" dates are repeated everywhere, and in the "Input" are correct.

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>