2011-03-16 37 views
0

我有python腳本,使用stylesheet.xsl將data.xml轉換爲html。 而我有一個將html標籤插入樣式表的問題。 我想將所有生成的值放入表格單元格中。也許有人經歷可以幫助我?
如何將html標籤放入XSL樣式表中?


    xsl:choose 
    xsl:when test="$NECoords = 'true'" 
     xsl:value-of select="concat($PtStr, $NthStr, $EastStr, $ElevStr, ' ', $TimeStr, $hzPrec, $vtPrec, $PDOP, $aRMS, $NbrSat, $NbrInt)"/> 
    /xsl:when> 
    

我想知道如何把上述連接的字符串成表格單元格中輸出HTML文件,如:
enter image description here
,每個值應放至不同的細胞,就像這樣:
enter image description here

+1

我不認爲任何人會跟隨你的鏈接。你需要縮小問題的範圍。你需要解釋問題是什麼:不是說你有問題,而是說你想要什麼樣的產出,你嘗試過什麼,以及這有什麼影響。 – 2011-03-16 18:45:35

+0

你在問如何輸出元素?閱讀http://www.w3.org/TR/xslt#section-Creating-Elements-and-Attributes – 2011-03-16 22:48:37

回答

1

怎麼樣使用

string-join((concat('<td>',$firsElement),..(elements)..,concat($lastElement,'</td>')) ,'</td><td>') 

我認爲這個代碼將產生類似

<td>$firstElement</td><td>$secEl</td><td>..(n-cells)..</td><td>$lastElement</td> 

我不知道是否有問題與<td>元素,在這種情況下,你必須轉義(&lt; &gt;)。

也許您必須將此片段添加到xsl:stylesheet聲明中。

xmlns:fn="http://www.w3.org/2005/02/xpath-functions" 

http://www.w3schools.com/xpath/xpath_functions.asp#string

+0

謝謝,它似乎正是我要做的,但我得到錯誤與您的代碼:( – daikini 2011-03-16 23:22:16

+0

可以你發佈了錯誤? – fdaines 2011-03-17 13:02:08

+0

未知的系統函數string-join在我的xml編輯器中 – daikini 2011-03-17 17:25:12