微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 如何使用XSL代码在HTML表格中显示图像?

我为XML Web服务创建了一个XSL样式表.我有我的HTML上的数据库输出的图像链接.但我的XSL只显示链接,但不显示链接包含的图像.我想使用XSL在HTML表格中显示直接图像.

这是我的XSL代码

    <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <h2>Birdcatch XSLT</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th>id</th>
        <th>Species</th>
        <th width="50%">About_bird</th>
        <th>Date_added</th>
        <th>Address</th>
        <th>Age</th>
        <th>Sex</th>
        <th>Latitiude</th>
        <th>Longitiude</th>
        <th>Image</th>
        <th>Added_by</th>
      </tr>
      <xsl:for-each select="Birdcatch/BIrds/Bird">
      <tr>
        <td><xsl:value-of select="@id" /></td>
        <td><xsl:value-of select="Species" /></td>
        <td><xsl:value-of select="About_bird" /></td>
        <td><xsl:value-of select="Date_added" /></td>
        <td><xsl:value-of select="Address" /></td>
        <td><xsl:value-of select="Age" /></td>
        <td><xsl:value-of select="Sex" /></td>
        <td><xsl:value-of select="Location/Latitiude" /></td>
        <td><xsl:value-of select="Location/Longitiude" /></td>
        <td><xsl:value-of select="Image" /></td>
        <td><xsl:value-of select="Added_by" /></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

我想在表格的Image col列中显示图像.我怎样才能做到这一点?

解决方法:

代替:

<td><xsl:value-of select="Image" /></td>

尝试:

<td><img src="{Image}"></img></td>

未经测试,因为未提供XML源.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐