xslt转换在删除根节点之前无法工作。我试图使用XSLT从Met Office Web服务中提取以下XML的标题,但是XSLT选择返回空白。资料来源:<RegionalFcst xmlns="www.metoffice.gov.uk/xml/metoRegionalFcst" createdOn="2016-01-13T02:14:39" issuedAt="2016-01-13T04:00:00" regionId="se">
<FcstPeriods>
<Period id="day1to2">
<Paragraph title="Headline:">Frosty start. Bright or sunny day.</Paragraph>
<Paragraph title="Today:">A clear and frosty start in west, but cloudier in Kent with isolated showers. Then dry with sunny periods.
Increasing cloud in west later will bring coastal showers with freshening southerly winds. Chilly inland, but less cold near coasts.
Maximum Temperature 8C.</Paragraph>
</Period>
</FcstPeriods></RegionalFcst>我的XSLT:<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0"xmlns:xsl="
<xsl:template match="/">
<html>
<body>
<xsl:value-of select="FcstPeriods/Period/Paragraph"/>
</body>
</html></xsl:template></xsl:stylesheet>我已经把词根改成/RegionalFcst并尝试了其他类似的更改,例如在Fcstperiods之前添加一个前导斜杠,但是在我从源XML中删除第一行和最后一行之前,没有什么工作有效-然后它就完美地工作了。这在测试中很好,但是我当然想使用MetOffice提供的Web服务,他们就是这样呈现的。有什么想法吗?
3 回答
犯罪嫌疑人X
TA贡献2080条经验 获得超4个赞
问题
解
XSLT1.0
<xsl:stylesheet version="1.0"xmlns:xsl=" exclude-result-prefixes="met"><xsl:template match="/"> <html> <body> <xsl:value-of select="met:RegionalFcst/met:FcstPeriods/met:Period/met:Paragraph[@title='Headline:']"/> </body> </html></xsl:template></xsl:stylesheet>
MMMHUHU
TA贡献1834条经验 获得超8个赞
来自: <xsl:value-of select="FcstPeriods/Period/Paragraph"/>
致: <xsl:value-of select="//*:FcstPeriods/*:Period/*:Paragraph"/>
添加回答
举报
0/150
提交
取消