精彩的人生

          好好工作,好好生活

          BlogJava 首頁 新隨筆 聯系 聚合 管理
            147 Posts :: 0 Stories :: 250 Comments :: 0 Trackbacks
          先看個例子:
          <xsl:call-template name="footer">
          <xsl:with-param name="date" select="@lastupdate"/>
          </xsl:call-template>
          <xsl:template name="footer">
          <xsl:param name="date">today</xsl:param>
          <hr/>
          <xsl:text>Last update: </xsl:text>
          <xsl:value-of select="$date"/>
          </xsl:template>
          對xml模板 來說,name屬性是很關鍵的 call-template /apply-template 的name必須要和模板的name
          相對應。模板相當于一個函數,可以暫時這么看。而name相當于函數名稱把。
          在call-template中 使用xsl:with-param 相當于函數參數輸入
          而參數聲明相當就是在xsl:template的 xsl:param
          說到xsl:variable。
          可以用<xsl:variable name="ShowDepth"><計算的值></xsl:variable>來聲明
          相當于c中的  const 因為變量一旦聲明就無法再被改變。
          對于xsl:param和xsl:variable 都可以用 $+name 來直接選擇比如
          <xsl:value-of select="$date"/>  就是選擇date變量或者參數
          變量和參數,都是有聲明范圍的 這點和語言中的道理一樣。
          最后最最重要一點 :xsl的variable是常量不能再改變
          				
          						
          								
          										不要被它的名稱迷惑、
          								
          						
          				
          		
          posted on 2007-03-14 16:28 hopeshared 閱讀(5399) 評論(1)  編輯  收藏 所屬分類: Web

          Feedback

          # re: xsl:variable 與 xsl:param (轉) 2008-06-18 09:40 qjy
          先看個例子:
          <xsl:call-template name="footer"><xsl:with-param name="date" select="@lastupdate"/></xsl:call-template>
          <xsl:template name="footer"> <xsl:param name="date">today</xsl:param> <hr/> <xsl:text>Last update: </xsl:text> <xsl:value-of select="$date"/></xsl:template>
          對xml模板 來說,name屬性是很關鍵的 call-template /apply-template 的name必須要和模板的name
          相對應。模板相當于一個函數,可以暫時這么看。而name相當于函數名稱把。
          在call-template中 使用xsl:with-param 相當于函數參數輸入
          而參數聲明相當就是在xsl:template的 xsl:param
          說到xsl:variable。
          可以用<xsl:variable name="ShowDepth"><計算的值></xsl:variable>來聲明
          相當于c中的 const 因為變量一旦聲明就無法再被改變。
          對于xsl:param和xsl:variable 都可以用 $+name 來直接選擇比如
          <xsl:value-of select="$date"/> 就是選擇date變量或者參數
          變量和參數,都是有聲明范圍的 這點和語言中的道理一樣。
          最后最最重要一點 :xsl的variable是常量不能再改變



          不要被它的名稱迷惑、

            回復  更多評論
            


          只有注冊用戶登錄后才能發表評論。


          網站導航:
          博客園   IT新聞   Chat2DB   C++博客   博問  
           
          主站蜘蛛池模板: 鸡东县| 务川| 梨树县| 石城县| 永善县| 平南县| 特克斯县| 涟源市| 八宿县| 广饶县| 射洪县| 长岭县| 冕宁县| 厦门市| 宜宾县| 泽库县| 洞头县| 黑河市| 安新县| 买车| 定日县| 大同县| 汾阳市| 手游| 澎湖县| 南江县| 仙桃市| 宁化县| 大城县| 五华县| 闸北区| 墨江| 莒南县| 大丰市| 陵川县| 韶山市| 岗巴县| 望都县| 肇东市| 苍山县| 耒阳市|