3
我正在維護一個xsl-fo文件。我既不擅長xslt,也不在xsl-fo,每年我只接觸一次該文件。如何重新使用xsl-fo塊?
我注意到該文件中有很多重複。例如,我在不同的上下文中有兩次(逐字)確切區塊:
<xsl:if test="ReleaseNote!=''">
<fo:block background-color="#ffeeee" padding="5mm" font-size="12pt" text-indent="0" border-style="solid" border-width="1px" border-color="red">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="20mm" />
<fo:table-column column-width="135mm" />
<fo:table-body>
<fo:table-row>
<fo:table-cell margin="0" padding="0" text-align="justify">
<fo:block text-align="justify">
<fo:external-graphic src="pic/warning.png" content-width="12mm" content-height="12mm" />
</fo:block>
</fo:table-cell>
<fo:table-cell margin="0" padding="0">
<fo:block linefeed-treatment="preserve">
<xsl:value-of select="ReleaseNote" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:if></fo:block>
如何刪除此重複?我可以預先定義這個塊,然後在xslt中重新使用它的「引用」嗎?
可能重複[如何在XSL中重複使用代碼](http://stackoverflow.com/questions/15711840/how-can-i-reuse-code-in-xsl) –