只要我不包含该元素及其子元素,xslt 就可以工作。我认为与href =有关...
Can anyone see how to get the template to work while still leaving the <links> node in??
我根本无法调整xml格式。
这是下面的示例 xmls 和模板。注意带有 href 属性的粗体链接元素。如果我删除它,一切正常。如果我把它留在它失败。
在此先感谢您的帮助。JB。
XML:
<?xml version="1.0" encoding="utf-8"?>
<oicMessage xmlns="http://abc.com/oic/2012/04/message">
<header>
<publisher>Gentle</publisher>
<messageId>8685217a-9237-464d-8a94-33d7f1a41542</messageId>
<eventCorrelationId>00000000-0000-0000-0000-000000000000</eventCorrelationId>
<messageDate>2013-10-14T16:00:00.0000000+00:00</messageDate>
<receivedTimestamp />
<contextId>Unknown</contextId>
<messageName>JHB-3C Up to 7 Stable Period Found</messageName>
<messageDescription>JHB-3C Up to 7 Stable Period Found</messageDescription>
<messageTypeUri>oic/rtrm/event/stableperiod/uptosevenfound</messageTypeUri>
</header>
<payload>
<notificationMessage>
<reason />
<action />
<equipment>JHB-3C</equipment>
<severityName>None</severityName>
<severityColour>FFFFFF</severityColour>
<severityOrdinal>0</severityOrdinal>
**<links>
<link href="[BIGFISH Server URL]/eplant/default.asp? page_id=24001&GPW=JHB-3C&PA_PWELL=JHB-3C&time=1381766400">BIGFISH Page</link>
</links>**
<notificationData>
<group name="Gentle">
<request>
<start>2013-10-14T15:00:00.0000000+00:00</start>
<end>2013-10-14T16:00:00.0000000+00:00</end>
<sampleMethod>Average</sampleMethod>
<interval>60</interval>
</request>
<timeseriesdata>
<name namingsystem="BF">JHB-3C:BHT.PDHG.degC</name>
<displayName>Temperature Input</displayName>
<unit>degC</unit>
<value time="2013-10-14T16:00:00.0000000+00:00" status="good"/>
</timeseriesdata>
<timeseriesdata>
<name namingsystem="BF"/>
<displayName>Pressure Input</displayName>
<unit />
<value time="2013-10-14T16:00:00.0000000+00:00" status="good">:PHB.PDHG.psia</value>
</timeseriesdata>
<timeseriesdata>
<name namingsystem="BF"/>
<displayName>Window Size</displayName>
<unit />
<value time="2013-10-14T16:00:00.0000000+00:00" status="good">1d</value>
</timeseriesdata>
<timeseriesdata> <name namingsystem="BF">JHB-3C[Gentle]:TopTest.AnalysisPeriod.Duration</name>
<displayName>Analysis Period</displayName>
<unit />
<value time="2013-10-14T16:00:00.0000000+00:00" status="good"/>
</timeseriesdata>
</group>
</notificationData>
</notificationMessage>
</payload>
</oicMessage>
XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://abc.com/oic/2012/04/message" >
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Name</th>
<th>Value</th>
</tr>
<xsl:for-each select="t:oicMessage/t:payload/t:notificationMessage/t:notificationData/t:group/t:timeseriesdata">
<tr>
<td><xsl:value-of select="t:name" /></td>
<td><xsl:value-of select="t:value" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>