我從我的xsl xml讀取選擇中獲得0個結果。我懷疑這是元素路徑中的破折號/連字符。xml與破折號/連字符元素在xsl中選擇
XML:
<sa-rest xmlns="http://iemfsa.tivoli.ibm.com/REST" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<status-set state="expired" action-name="Test Plan" />
</sa-rest>
XSL:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<link rel="stylesheet" href="w3.css" />
<head>
</head>
<body>
<table>
<tr><th>Name</th><th>State</th></tr>
<tr>
<td><xsl:copy-of select="/sa-rest/status-set/@action-name"/></td>
<td><xsl:copy-of select="/sa-rest/status-set/@state"/></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
,但我得到的結果是:
<html>
<link rel="stylesheet" href="w3.css">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>
<body><table>
<tr>
<th>Name</th>
<th>State</th>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table></body>
</html>
我在哪裏出錯了?
這與連字符和與*名稱空間*無關* - 請參閱:http://stackoverflow.com/questions/34758492/xslt-transform-doesnt-work-until-i-remove-root-node/34762628#34762628 –