我有一些XSLT,它試圖爲圖像添加一個URL。到目前爲止,我已經使用XSLT將圖像添加到圖像
<xsl:if test="$currentPage/ImageOne != ''">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($currentPage/ImageOne, 0)/*"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="$currentPage/ImageOne"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
如果我再添XSLT節點
<xsl:attribute name="a">
<xsl:value-of select="http://somesite.com"/>
</xsl:attribute>
</xsl:element>
然後我得到一個解析器錯誤(在使用「一」,以超鏈接添加到圖片上面的代碼IM,但沒有任何工程。可能有人建議什麼問題呢?
感謝
新代碼
<xsl:if test="$currentPage/ImageOne != ''">
<xsl:element name="a">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($currentPage/ImageOne, 0)/*"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="$currentPage/ImageOne"/>
</xsl:attribute>
<xsl:element name="href">
<xsl:value-of select="'http://www.microsoft.com'"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:if>
你幾點解析錯誤? –
你在哪裏添加它? –