更新时间:2023-11-13 18:49:46
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:element name="html">
<xsl:element name="head">
<xsl:element name="title">Event: Concert</xsl:element>
</xsl:element>
<xsl:element name="body">
<xsl:apply-templates select="/listings/venue/event[@id='eve_01']"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="event">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:text>
http://url to image path/xml/task2/event_page
</xsl:text>
<xsl:value-of select="../image/text()"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
使用xsl:text,我能够指定图像路径网址然后接收图像元素string作为完成完整路径的文件名。
Using xsl:text, I was able to specify the image path url and then take in the image element string as the filename to complete the full path.