您现在的位置是:首页 >

c语言函数封装 XSL中几个封装的函数

火烧 2022-08-19 05:16:36 1037
XSL中几个封装的函数 布尔操作函数 lt ! ======================================================== gt lt ! Fu ctio : B

XSL中几个封装的函数  

c语言函数封装 XSL中几个封装的函数
     布尔操作函数      <! ======================================================== >   <! Function: BooleanOR(<value > <value >) => number >   <! Parameters: >   <! <value > the first number to be ORed >   <! <value > the second number to be ORed >   <! NB Only works with unsigned ints! >   <xsl:template name= BooleanOR >    <xsl:param name= value select= number( ) />    <xsl:param name= value select= number( ) />    <! recurse parameters >    <xsl:param name= bitval select= number( ) />    <xsl:param name= accum select= number( ) />    <! calc bits present on values >    <xsl:variable name= bit select= floor($value div $bitval) />    <xsl:variable name= bit select= floor($value div $bitval) />    <! do the OR on the bits >    <xsl:variable name= thisbit >    <xsl:choose>    <xsl:when test= ($bit != ) or ($bit != ) ><xsl:value of select= $bitval /></xsl:when>    <xsl:otherwise> </xsl:otherwise>    </xsl:choose>    </xsl:variable>    <! if last recurse then output the value >    <xsl:choose>    <xsl:when test= $bitval = ><xsl:value of select= $accum + $thisbit /></xsl:when>    <xsl:otherwise>    <! recurse required >    <xsl:call template name= BooleanOR >    <xsl:with param name= value select= $value mod $bitval />    <xsl:with param name= value select= $value mod $bitval />    <xsl:with param name= bitval select= $bitval div />    <xsl:with param name= accum select= $accum + $thisbit />    </xsl:call template>    </xsl:otherwise>    </xsl:choose>   </xsl:template>      <! ======================================================== >   <! Function: BooleanAND(<value > <value >) => number >   <! Parameters: >   <! <value > the first number to be ANDed >   <! <value > the second number to be ANDed >   <! NB Only works with unsigned ints! >   <xsl:template name= BooleanAND >    <xsl:param name= value select= number( ) />    <xsl:param name= value select= number( ) />    <! recurse parameters >    <xsl:param name= bitval select= number( ) />    <xsl:param name= accum select= number( ) />    <! calc bits present on values >    <xsl:variable name= bit select= floor($value div $bitval) />    <xsl:variable name= bit select= floor($value div $bitval) />    <! do the AND on the bits >    <xsl:variable name= thisbit >    <xsl:choose>    <xsl:when test= ($bit != ) and ($bit != ) ><xsl:value of select= $bitval /></xsl:when>    <xsl:otherwise> </xsl:otherwise>    </xsl:choose>    </xsl:variable>    <! if last recurse then output the value >    <xsl:choose>    <xsl:when test= $bitval = ><xsl:value of select= $accum + $thisbit /></xsl:when>    <xsl:otherwise>    <! recurse required >    <xsl:call template name= BooleanAND >    <xsl:with param name= value select= $value mod $bitval />    <xsl:with param name= value select= $value mod $bitval />    <xsl:with param name= bitval select= $bitval div />    <xsl:with param name= accum select= $accum + $thisbit />    </xsl:call template>    </xsl:otherwise>    </xsl:choose>   </xsl:template>      <! ======================================================== >   <! Function: BooleanXOR(<value > <value >) => number >   <! Parameters: >   <! <value > the first number to be XORed >   <! <value > the second number to be XORed >   <! NB Only works with unsigned ints! >   <xsl:template name= BooleanXOR >    <xsl:param name= value select= number( ) />    <xsl:param name= value select= number( ) />    <! recurse parameters >    <xsl:param name= bitval select= number( ) />    <xsl:param name= accum select= number( ) />    <! calc bits present on values >    <xsl:variable name= bit select= floor($value div $bitval) />    <xsl:variable name= bit select= floor($value div $bitval) />    <! do the XOR on the bits >    <xsl:variable name= thisbit >    <xsl:choose>    <xsl:when test= (($bit != ) and ($bit = )) or (($bit = ) and ($bit   != )) ><xsl:value of select= $bitval /></xsl:when>    <xsl:otherwise> </xsl:otherwise>    </xsl:choose>    </xsl:variable>    <! if last recurse then output the value >    <xsl:choose>    <xsl:when test= $bitval = ><xsl:value of select= $accum + $thisbit /></xsl:when>    <xsl:otherwise>    <! recurse required >    <xsl:call template name= BooleanXOR >    <xsl:with param name= value select= $value mod $bitval />    <xsl:with param name= value select= $value mod $bitval />    <xsl:with param name= bitval select= $bitval div />    <xsl:with param name= accum select= $accum + $thisbit />    </xsl:call template>    </xsl:otherwise>    </xsl:choose>   </xsl:template> lishixinzhi/Article/program/net/201311/13884  
永远跟党走
  • 如果你觉得本站很棒,可以通过扫码支付打赏哦!

    • 微信收款码
    • 支付宝收款码