加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-13 15:55:34 所属栏目:PHP教程 来源:网络整理
导读:我为 XML Web服务创建了一个XSL样式表.我有我的HTML上的数据库输出的图像链接.但我的XSL只显示链接,但不显示链接包含的图像.我想使用XSL在HTML表格中显示直接图像. 这是我的XSL代码 ?xml version="1.0" encoding="UTF-8"?xsl:stylesheet version="1.0"xmlns:
我为 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源.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读