0
下面的模板固定img/src
屬性,並在那裏,因爲年:二XSL模板禁用第一個
<xsl:template match="xh:img/@src">
<xsl:attribute name="src">
<xsl:value-of select="
if(string-length(substring-before(substring-after(
subsequence(parent::node()/following-sibling::comment(),1,1),'src="'),'.eps')) > 0)
then
concat('images/',tokenize(concat(substring-before(substring-after(
subsequence(parent::node()/following-sibling::comment(),1,1),'src="'),'.eps'),'.png'),'/')[last()])
else
data(self::node())"/>
</xsl:attribute>
</xsl:template>
現在我加入了下面的模板移動width
和height
到style
:
<xsl:template match="xh:img">
<img style="width:{@width}; height:{@height};">
<xsl:copy-of select="@*[not(name()='width' or name()='height')]"/>
</img>
</xsl:template>
第二個工作,但它「禁用」第一個。 如果我評論第二個,第一個作品。 有沒有合併它們的方法?
我真的沒有XSL的經驗,所以任何幫助,將不勝感激。
這很簡單嗎?我試圖合併它們......謝謝,它完美的工作! – marco