xsl tanımlanan php fonksiyonu

0 Cevap php

Ben bu XSL dosyası vardır:


< ?xml version="1.0" encoding="utf-8"?>

< xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl script" xmlns:script="script">

  < msxsl:script implements-prefix="script" language="C#">

< ![CDATA[

public string formatDate(string sDate)

          {
              string sRetval = "";          
              try
              {
                  System.IFormatProvider format = new System.Globalization.CultureInfo(sSourceCulture);
                  System.IFormatProvider format2 = new System.Globalization.CultureInfo(sTargetCulture);
                  DateTime dDate = DateTime.Parse(sDate, format);
                  sRetval = dDate.ToString(sFormat, format2);
              }
              catch {}
              return sRetval;
          }
    ]] >

  < / msxsl:script>


  < xsl:template match="/">


    < ?xsl:if test="count(//item) &gt; 0">
      <br />
      <div id="ForumsBox" class="NoTabBox300">
        <h2>forum</h2>
        <div class="NoTabBoxContent">

          <ul class="Article">
            <xsl:apply-templates select="//item" />
          </ul>
        </div>
      </div>

    </xsl:if>


  < /xsl:template>

  < xsl:template match="item">

    < xsl:if test="position() &lt;= 5">

      <li>

        < xsl:value-of select="script:formatDate(pubDate)" />

        < xsl:text disable-output-escaping="yes"> </xsl:text>
    ...

  < /xsl:template>


</ xsl:stylesheet>

Bir C # fonksiyonu CDATA bölümünde tanımlar vardır. Benzer php desteği bir şey mi?

0 Cevap