如何使用xslt將xml中的文本轉換爲html中的超鏈接。如何將xml中的文本轉換爲html中的超鏈接使用xslt
我的XML代碼
<Steps>
<Filepath>C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png</Filepath>
</Steps>
將其轉換成HTML我的XSLT代碼看起來像
<td width='15%'>
<xsl:element name="a">
\t <xsl:attribute name="href">
\t <xsl:value-of select="./Filepath"/>
\t </xsl:attribute>
\t <xsl:value-of select="./Filepath"/>
</xsl:element> \t \t \t \t \t \t \t \t \t \t \t \t \t \t
</td>
現在這代碼在html中寫入文件的整個路徑,但是我想只在文件的位置使用超鏈接在html中寫入「File」。下面
C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png
<td width="15%"><a href="C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png">C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png</a></td>
我的電流所產生的HTML代碼中給出我想要的是
<td width="15%"><a href="C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png">File</a></td>
誰能幫我我需要在xslt中做什麼更改。
在最後一個例子,你想要的 「文件」作爲''的內容?或者是「050615165617TC001_05_06_1516_57_11.png」的拼寫錯誤? – Richard