在XSL中添加超链接

最近由于工作需要,需要用到xml+xsl.碰到一个很有趣的问题.

页面使用了框架(iframe),如何在XSL中添加超链接,并在本窗口中打开呢?

于是参考书上的资料,自己写了一段,发现结果并不能在本窗口中打开.只会在新的窗口.

代码:

          <xsl:element name="a">
        <xsl:attribute name="href">
        <xsl:value-of select="@链接地址"/>
        </xsl:attribute>
        <xsl:attribute name="target">
        _top
        </xsl:attribute>
        <xsl:value-of select="@标题"/>
       </xsl:element>

后来在无意之下发现改成这样就完全没有问题了.

          <xsl:element name="a">
        <xsl:attribute name="href"><xsl:value-of select="@链接地址"/></xsl:attribute>
        <xsl:attribute name="target"> _top</xsl:attribute>
        <xsl:value-of select="@标题"/>
       </xsl:element>

也就是写一个属性的时候不要换行.

posted @ 2005-08-01 09:11  小强(占卜师)  阅读(3312)  评论(2编辑  收藏  举报