-3
在當天的匆忙和沮喪中,我並沒有明顯發佈足夠的相關信息,因此讓我重新解釋一下這個問題。謝謝你的耐心。卡住轉義字符的使用
我有一些XML所返回以下標籤:
etc...
<tr>
<td class="Label Center">22</td>
<td Indentation="4" class="Label Stub Left">Listings</td>
<tr>
<td class="Label Center">23</td>
<td Indentation="6" class="Label Stub Left">Notes<sup>1</sup></td>
</tr>
etc...
我處理它們下面的方式,一切都很好,除了一兩件事:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:param name="TABLENUM"/>
<xsl:template match="/">
<xsl:for-each select="/Response/MakeStory/div/div[@class='Table'][$TABLENUM]">
<h3 style="margin:2px; padding:0;"><xsl:value-of select="div [@class='TableTitle']"/></h3>
<h4 style="margin:2px; padding:0;"><em><xsl:value-of select="div[@class='TableSubTitle']"/></em></h4>
<xsl:for-each select="div[@class='HtmlTable']/table">
<table cellpadding="3" cellspacing="0">
<xsl:copy-of select="thead"/>
<xsl:apply-templates select="tbody"/>
</table>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template match="tbody">
<xsl:copy>
<xsl:apply-templates select="tr"/>
</xsl:copy>
</xsl:template>
<xsl:template match="tr">
<xsl:copy>
<xsl:apply-templates select="td"/>
</xsl:copy>
</xsl:template>
<xsl:template match="td[contains(@class, 'Left')]">
<td align="left" style="padding-left: {@Indentation * 3}px;">
<xsl:copy-of select="node()"/>
</td>
</xsl:template>
<xsl:template match="td[contains(@class, 'Center')]">
<td align="center">
<xsl:copy-of select="node()" />
</td>
</xsl:template>
我的問題,其與上面的例子一樣,當輸出項目時,轉義標籤被視爲文字並且從字面上寫出註釋,而不是像t那樣上標數字他的筆記。
我已經嘗試了很多方法,其中包括,xsl文本轉義字符設置爲不包裹節點,試圖應用模板而不是使用複製選擇節點選項與選擇條件查找轉義字符,但我很遺憾沒有任何運氣。
什麼是最好的方法來處理這個問題。我確信這非常簡單,但是我對XSLT的有限瞭解還沒有真正完成。任何信息,將不勝感激。
哦,我想「我有XSLT 2,但我不確定。
謝謝。
不是很清楚,我很害怕。嘗試給出一個你的輸入和期望輸出的例子:希望能夠清理一些事情。 –
同上:你沒有告訴我們你想要發生什麼(預期產出),也沒有告訴我們實際發生了什麼(實際產出)。 – LarsH
該問題已經通過更多相關信息進行了修訂。謝謝你的時間。 – EXL