我一直在编写一个(令人难以置信的简单)XSLT来让MS Access读取从另一个软件包中获得的此XML文档,并且我无法获取值要转移的元素。当我输入XML文档并应用XSLT转换时,它给了我5个字段,“EventID”,“DeviceID”,“Officer”,“Start”和“Stop”,这非常棒。 EventID,Start和Stop成功地显示XML文档中的所有源属性,但DeviceID和Officer元素为空。XSLT新手 - 将XML导入到MS Access中留下元素值空白
这里的源XML:
<?xml version="1.0" encoding="UTF-8"?>
<recording-event desiredStreamState="Routine" dvr="dvr" stop-time="2016-12-22T02:28:21Z" start-time="2016-12-22T02:20:08Z" stop-tick="1996428" start-tick="1995441" reid="00:00:12:a0:27:c0-1990499">
<info>
<officer id="60">Foo Bar</officer>
<dept>9bcd1176-1c45-493f-ac27-440f1e191feb</dept>
<vehicle>VHC2-010176</vehicle>
<protected>0</protected>
</info>
<video hashType="none">
<metadata hashCode="1b569a7dcb7f0212b574e303a4eb8031" name="tick1990499-tick1990499.mtd"/>
<streams>
<stream stop-tick="1996428" start-tick="1995441" num="1">
<file hashCode="0e089f550866d3c8dd6d898516fdbb33" name="tick1995441-tick1996428-video1.mp4"/>
<file hashCode="113fd040423905529e456985b160298b" name="tick1995441-tick1996428-video1.vtt"/>
<file hashCode="c87cbb2e85292d3a8024cf7000473736" name="tick1995441-tick1996428-video1.json"/>
</stream>
</streams>
</video>
<etl ContentsRevision="1"/>
</recording-event>
下面是我使用XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="recording-event">
<Info>
<EventID><xsl:apply-templates select="@reid"/></EventID>
<DeviceID><xsl:value-of select="vehicle"/></DeviceID>
<Officer><xsl:value-of select="officer"/></Officer>
<Start><xsl:apply-templates select="@start-time"/></Start>
<Stop><xsl:apply-templates select="@stop-time"/></Stop>
</Info>
</xsl:template>
</xsl:stylesheet>
就是这样。我试着在这里搜索问题数据库,并且我认为它可能与命名空间有关,但当我与它们混淆时没有运气。
我想它返回:
EventID= 2:a0:27:c0-1990499
DeviceID= VHC2-010176
Officer= Foo Bar
Start= 2016-12-22T02:28:21Z
Stop= 2016-12-22T02:28:21Z
什么它目前给我:
EventID= 2:a0:27:c0-1990499
DeviceID=
Officer=
Start= 2016-12-22T02:28:21Z
Stop= 2016-12-22T02:28:21Z
你必须向我们展示了预期的输出和期望的输出,在* XML *。 –