2017-03-01 105 views
1

我正在使用IBM Watson Explorer將HTML轉換爲XML。有轉換器,我可以使用XSLT將我的HTML轉換爲XML。如何使用XSLT將HTML的視圖源轉換爲XML?

這是HTML代碼的查看源代碼:

<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
     <meta name="ConvertedBy" content="Perceptive" /> 
     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> 
     <meta name="CreationDate" content="2012/06/11 11:33:56-04'00'" /> 
     <meta name="Creator" content="Adobe InDesign CS5 (7.0.4)" /> 
     <meta name="Keywords" content="130728_47_FRM_FILI_Conservatorship" /> 
.... 
... 
    </head> 
</html> 

我想要做的是提取的元標記關鍵字的值。我想我的XML看起來像這樣:

<Keywords> 
130728_47_FRM_FILI_Conservatorship 
<Keywords> 

我應該在我的XSLT中做什麼?我是XSLT的新手。我應該在我的XML模板中指定哪個xpath?

回答

1

這樣的事情應該與工作

<xsl:template match="/"> 

<Keywords> 
    <xsl:value-of select="html/head/meta[@name='Keywords']/@content"/> 
</Keywords> 

</xsl:template> 

另外,xpath- //meta[@name='Keywords']/@content將工作以及

+1

感謝,對於攝影指導Vinit的XSLT – Rose