XML的格式问题XSL
发布时间:2020-12-15 23:12:20 所属栏目:百科 来源:网络整理
导读:如何设定文件的超链接?并且在新的标签页中打开: td bgcolor="#66CC33"xsl:variable name="href"xsl:value-of select="@fileSrc"//xsl:variablea href="{$href}" target="_blank"xsl:value-of select="@fileSrc"//a/td target的目的是在新的标签页中打开,f
如何设定文件的超链接?并且在新的标签页中打开: <td bgcolor="#66CC33"> <xsl:variable name="href"> <xsl:value-of select="@fileSrc"/></xsl:variable> <a href="{$href}" target="_blank"> <xsl:value-of select="@fileSrc"/> </a> </td> target的目的是在新的标签页中打开,fileSrc内容如下: 这样就会在新的页面中打开这个xml文件
如何设定图片超链接?并在新的标签页中打开?有两种方式: 第一种,直接定义图片的内容,select是没有@符号的,select直接用等号赋值,记住不要忘记单引号。 <td> <xsl:variable name="standard"><xsl:value-of select="'StandardImg.jpg'"/></xsl:variable> <a href="{$standard}" target="_blank"> <xsl:attribute name="href" target="_blank"><xsl:value-of select="'StandardImg.jpg'"/></xsl:attribute> <xsl:element name="image" target="_blank"> <xsl:attribute name="width">60</xsl:attribute> <xsl:attribute name="height">50</xsl:attribute> <xsl:attribute name="src" target="_blank"><xsl:value-of select="'StandardImg.jpg'"/></xsl:attribute> </xsl:element> </a> </td> 第二种,通过xml的标签获得图片的url,select是有@符号的。 <td> <xsl:variable name="herf"><xsl:value-of select="@imgSrc"/></xsl:variable> <a href="{$herf}" target="_blank"> <xsl:attribute name="href" target="_blank"><xsl:value-of select="@imgSrc"/></xsl:attribute> <xsl:element name="image" target="_blank"> <xsl:attribute name="width">60</xsl:attribute> <xsl:attribute name="height">50</xsl:attribute> <xsl:attribute name="src" target="_blank"><xsl:value-of select="@imgSrc"/></xsl:attribute> </xsl:element> </a> </td> 如何设定图片超链接?并在当前标签页中打开? <td> <xsl:for-each select="imgSrc"> <xsl:element name="a"> <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute> <xsl:element name="image"> <xsl:attribute name="width">60</xsl:attribute> <xsl:attribute name="height">50</xsl:attribute> <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute> </xsl:element> </xsl:element> </xsl:for-each> </td> 其中imgSrc在xml文件中的定义如下:
最后的效果图: 文件超链接:
图片超链接:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |