2016-12-29 1 views
0

MS Accessに別のソフトウェアパッケージから取得したこのXML文書を読み込ませるための(信じられないほど単純な)XSLTを作成しました。転送する要素の数。私がXML文書をソースしてXSLT変換を適用すると、 "EventID"、 "DeviceID"、 "Officer"、 "Start"、 "Stop"の5つのフィールドが表示されます。 EventID、Start、およびStopフィールドにはXML文書のすべてのソース属性が正常に入力されますが、DeviceIDおよびOfficer要素は空白になります。それだけですXSLT newbie - MS AccessへのXMLインポートで要素値が空白になる

<?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> 

:ここで私が使用しているXSLTだ

<?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> 

は、ここでソースXMLです。私はここで質問データベースを検索しようとしましたが、おそらく名前空間と関係していると思いますが、私がそれらを使いこなしたときには運がありません。

What it looks like when I import into MS Access

私はそれを返すしたいと思います:

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 
+0

あなたは私たち*のXMLでの予想される出力と所望の出力、*を表示する必要があります。 –

答えて

0

あなたのパスは、XML内の要素を一致させるためにオフになっています。 OfficeとVehicleはどちらもInfo要素のネストされた要素です。以下のXSLを使って試してみて、あなたにも車(デバイスID)と役員の値を取得する必要があります。

<?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="info/vehicle"/></DeviceID> 
    <Officer><xsl:value-of select="info/officer"/></Officer> 
    <Start><xsl:apply-templates select="@start-time"/></Start> 
    <Stop><xsl:apply-templates select="@stop-time"/></Stop> 
</Info> 
</xsl:template> 

+0

ありがとうございました!私はあなたの時間を感謝します! – Kyle

関連する問題