XSL Grammar

<xsl:template match="/">

means:: The <xsl:template> element defines a template. The match="/" attribute associates the template with the root of the XML source document.

<xsl:value-of>

The <xsl:value-of> element can be used to extract the value of an XML element and add it to the output stream of the transformation:

<xsl:for-each>

The XSL <xsl:for-each> element can be used to select every XML element of a specified node-set:

<xsl:sort>

To sort the output, simply add an <xsl:sort> element inside the <xsl:for-each> element in the XSL file:

<xsl:if>

To add a conditional test, add the <xsl:if> element inside the <xsl:for-each> element in the XSL file:

<xsl:choose>

<xsl:for-each select="catalog/cd">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <xsl:choose>
        <xsl:when test="price &gt; 10">

          <td bgcolor="#ff00ff">
          <xsl:value-of select="artist"/></td>
        </xsl:when>
        <xsl:otherwise>

          <td><xsl:value-of select="artist"/></td>
        </xsl:otherwise>
      </xsl:choose>

    </tr>
    </xsl:for-each>

 

 

1)      $dvt_1_automode = "1" OR $dvt_1_automode = "0" -> This is a variable which is used to switch modes in a DVWP, usually between display and edit.  SharePoint Designer creates this variable.
2) "position() mod 2 =1" -> position() returns the current item's position in the rowset. So if the item is number 7 of 312, position() returns 7. Used here to determine if the row is even or odd, usually for alternating row formatting using the ms-alternating CSS class.
3) <
xsl:param name ="dvt_apos">
-> This parameter is usually created by SharePoint Designer in DVWPs to provide the &apos; or apostrophe (') character for use in the XSL. Because of the highly reserved nature of this character, it can be a bear to work with, and this way you have a parameter containing it to use.
4) 
ddwrt:cf_ignore ="1" -> I've never figured out what this function is for.  The only documentation I know of that's worth anything is from Serge van den Oever:
http://msdn.microsoft.com/en-us/library/dd583143(office.11).aspx and this function is not described there.
5
) <xmsln:ddwrt2="urn:frontpage:internal"> -> Another one I'm not sure of, but this is a declaration of the ddwrt2 namespace (also undocumented, as far as I can determine).

<xsl:with-param>

元素定义了传递给模板的参数的值

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值