ÓÃC#»òJavaScriptµÄÀ©Õ¹XSLT_C/C++ÓïÑÔ_ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤»ùµØ--Powered by WWW.RONGSEN.COM.CN

ÓÃC#»òJavaScriptµÄÀ©Õ¹XSLT

×÷ÕߣººÚ¿Í·ÀÏßÍø°²C/C++½Ì³Ì»ùµØ À´Ô´£ººÚ¿Í·ÀÏßÍø°²C/C++½Ì³Ì»ùµØ ä¯ÀÀ´ÎÊý£º0

±¾Æª¹Ø¼ü´Ê£ºÀ©Õ¹/> select
ºÚ¿Í·ÀÏßÍø°²ÍøѶ£º    ½ñÌìÔÚumbracaÉÏ¿´µ½ÕâÑùһƪÎÄÕ£¬¿ÉÒÔÀûÓÃC#ºÍJavaScriptÀ©Õ¹XSLT£¬ËµÊµÔڵģ¬ÒÔÇ°²»ÖªµÀ°¡£¬Ç°¼¸Ìì¿´µ½ÓÐ벩Ö÷ʵÏÖÁËÒ»¸ösplit·½·¨£¬ÀûÓÃÔ­ÓеÄxsltº¯Êý£¬ÏÖÔÚ¿´À´¿ÉÒÔÖ±½Ó±à³ÌʵÏÖ...
    ½ñÌìÔÚumbracaÉÏ¿´µ½ÕâÑùһƪÎÄÕ£¬¿ÉÒÔÀûÓÃC#ºÍJavaScriptÀ©Õ¹XSLT£¬ËµÊµÔڵģ¬ÒÔÇ°²»ÖªµÀ°¡£¬Ç°¼¸Ìì¿´µ½ÓÐ벩Ö÷ʵÏÖÁËÒ»¸ösplit·½·¨£¬ÀûÓÃÔ­ÓеÄxsltº¯Êý£¬ÏÖÔÚ¿´À´¿ÉÒÔÖ±½Ó±à³ÌʵÏÖÒ»¸ösplitº¯ÊýÁËŶ¡£
ÏÂÃæ¿´ÏÂÔõôÓÃC#ºÍJavaScriptÀ©Õ¹XSLT£º
Ò»¡¢Ê¹ÓÃC#
ÏÈÉÏ´úÂ룺
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [  <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform%22
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:mycustomprefix="urn:mycustomprefix"
exclude-result-prefixes="msxml umbraco.library mycustomprefix msxsl">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<msxsl:script language="CSharp" implements-prefix="mycustomprefix">
<![CDATA[
public int? testNumber(int? num)
{
if(num> 5 || num<= 0 || num== null)
{
return 5;
}
else
{
return num;
}
}
]]>
</msxsl:script>
<xsl:param name="currentPage"/>
<xsl:variable name="numberToTest" select="mycustomprefix:testNumber(number(/macro/numberToTest))"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:value-of select="$numberToTest"/>
</xsl:template>
</xsl:stylesheet>
ÉÏÃæ´úÂëʵÏÖÁËÒ»¸ötestNumberº¯Êý£¬µ±ÊäÈëÊýÖµ´óÓÚ5ʱ·µ»Ø5£¬Ð¡ÓÚ5ʱ·µ»ØÊýÖµ¡£Àý×Ӻܼòµ¥£¬¿´Ò»ÑÛ¾ÍÃ÷ÁË£¬²»¹ýÈ¥¶Ôϲ»¶xsltµÄͬÈÊ´øÀ´ºÜ´óµÄ·¢»Ó¿Õ¼äŶ¡£
¶þ¡¢ÓÃJavaScript
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [  <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform%22
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:mycustomprefix="urn:mycustomprefix"
exclude-result-prefixes="msxml umbraco.library mycustomprefix msxsl">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<msxsl:script language="JavaScript" implements-prefix="mycustomprefix">
<![CDATA[
function testNumber(num)
{
if(num> 5 || num<= 0 || num== null)
{
return 5;
}
else
{
return num;
}
}
]]>
</msxsl:script>
<xsl:param name="currentPage"/>
<xsl:variable name="numberToTest" select="mycustomprefix:testNumber(number(/macro/numberToTest))"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:value-of select="$numberToTest"/>
</xsl:template>
</xsl:stylesheet>
ºÍʹÓÃC#Ò»Ñù£¬²»¶à˵ÁË
ÏÖÔھͿÉÒÔʵÏÖÄǸösplitº¯ÊýÁË£¬ÊÇ°É£¿²»ÓÃÄǸösubstring-beforeºÍsubstring-afterÁËŶ
    ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤·½°¸±¾ÆªÁ¬½Ó£ºhttp://www.rongsen.com.cn/show-15304-1.html
Íøվά»¤½Ì³Ì¸üÐÂʱ¼ä:2012-04-04 22:52:58  ¡¾´òÓ¡´ËÒ³¡¿  ¡¾¹Ø±Õ¡¿
ÎÒÒªÉêÇë±¾Õ¾£ºNµã | ºÚ¿Í·ÀÏß¹ÙÍø |  
רҵ·þÎñÆ÷ά»¤¼°Íøվά»¤ÊÖ¹¤°²È«´î½¨»·¾³£¬ÍøÕ¾°²È«¼Ó¹Ì·þÎñ¡£ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤»ùµØÕÐÉ̽øÐÐÖУ¡QQ:29769479

footer  footer  footer  footer