XSL语言学习

1.介绍:xsl是xml的样式表,css是html的样式表

2.内容:xsl一般包含三部分:

  a. 一个转换xml文档的方法;(XSLT)

  b. 一个定义xml部分和模式的方法;(XPath)

  c. 一个格式化xml文档的方法;(XSL)

如果对此还不能理解,那么可以先将xsl理解成:一种将xml转换成html的语言,一种可以过滤和分类xml数据的语言,

一种可以对xml文档的部分进行寻址的语言,一种可以数据值格式化xml数据的语言(如用红色显示负数),一种向不同设备输出

xml数据的语言(如屏幕、纸或者声音)。

 xsl循环

<xsl:for-each select='plan'>

 xsl取值 

<xsl:value-of select='./@plantitle'/>

 xsl定义变量

<xsl:variable name="planid" select="./@plugid"/>

xsl添加属性

            <xsl:attribute name="rowspan">
              <xsl:value-of select="$plugid+1" />
            </xsl:attribute>

xsl concat连接字符串

            <xsl:attribute name="class">
              <xsl:value-of select="concat('td',$key+1)" />
            </xsl:attribute>

xsl count 统计个数

<xsl:variable name="num" select="count($planid)"/>

xsl添加图片

            <img>
              <!--<xsl:attribute name="src">
                <xsl:value-of select="" />
              </xsl:attribute>-->
            </img>

  

 

  

 

  

 

  

 

 

 

posted @ 2013-01-26 13:58  赵治鲁  阅读(308)  评论(0编辑  收藏  举报