Saturday 15 May 2010

Access 2007 doesn't import all element data from XML file -



Access 2007 doesn't import all element data from XML file -

i have xml info need import access farther processing. copied here little part of data:

<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="access question.xsl"?> <catalogue> <app action="a" id="308"> <basevehicle id="67"/> <!-- 1983 porsche 911 --> <bodytype id="9"/> <!-- coupe --> <enginebase id="15"/> <!-- h6 3.0l --> <note>oe sensor technology</note> <qty>1</qty> <parttype id="5132"/> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position id="2172"/> <!-- upstream --> <part>101027</part> </app> <app action="a" id="309"> <basevehicle id="67"/> <!-- 1983 porsche 911 --> <bodytype id="10"/> <!-- convertible --> <enginebase id="15"/> <!-- h6 3.0l --> <note>oe sensor technology</note> <note>for vehicles without start-stop function</note> <qty>1</qty> <parttype id="5132"/> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position id="2172"/> <!-- upstream --> <part>101027</part> </app> <app action="a" id="310"> <basevehicle id="68"/> <!-- 1984 porsche 911 --> <enginebase id="16"/> <!-- h6 3.2l --> <enginevin id="13"/> <!-- b --> <note>oe sensor technology</note> <note>for vehicles without start-stop function</note> <qty>1</qty> <parttype id="5132"/> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position id="2172"/> <!-- upstream --> <part>103918</part> </app> <app action="a" id="311"> <basevehicle id="68"/> <!-- 1984 porsche 911 --> <enginebase id="1778"/> <!-- h6 3.2l --> <aspiration id="5"/> <!-- naturally aspirated --> <qty>1</qty> <parttype id="5132"/> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position id="2172"/> <!-- upstream --> <part>103918</part> </app> </catalogue>

for info utilize xslt:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="catalogue/app/@*"> <xsl:element name="{name()}"> <xsl:value-of select="."/> </xsl:element> </xsl:template> <xsl:template match="catalogue/app/note[1]"> <note1><xsl:apply-templates select="@*|node()"/></note1> </xsl:template> <xsl:template match="catalogue/app/note[2]"> <note2><xsl:apply-templates select="@*|node()"/></note2> </xsl:template> <xsl:template match="catalogue/app/note[3]"> <note3><xsl:apply-templates select="@*|node()"/></note3> </xsl:template> <xsl:template match="catalogue/app/note[4]"> <note4><xsl:apply-templates select="@*|node()"/></note4> </xsl:template> <xsl:template match="catalogue/app/note[5]"> <note5><xsl:apply-templates select="@*|node()"/></note5> </xsl:template> <xsl:template match="catalogue/app/note[6]"> <note6><xsl:apply-templates select="@*|node()"/></note6> </xsl:template> <xsl:template match="catalogue/app/note[7]"> <note7><xsl:apply-templates select="@*|node()"/></note7> </xsl:template> <xsl:template match="catalogue/app/note[8]"> <note8><xsl:apply-templates select="@*|node()"/></note8> </xsl:template> <xsl:template match="catalogue/app/note[9]"> <note9><xsl:apply-templates select="@*|node()"/></note9> </xsl:template> <xsl:template match="catalogue/app/note[10]"> <note10><xsl:apply-templates select="@*|node()"/></note10> </xsl:template> <xsl:template match="catalogue/app/note[11]"> <note11><xsl:apply-templates select="@*|node()"/></note11> </xsl:template> <xsl:template match="catalogue/app/note[12]"> <note12><xsl:apply-templates select="@*|node()"/></note12> </xsl:template> <xsl:template match="catalogue/app/note[13]"> <note13><xsl:apply-templates select="@*|node()"/></note13> </xsl:template> <xsl:template match="catalogue/app/note[14]"> <note14><xsl:apply-templates select="@*|node()"/></note14> </xsl:template> <xsl:template match="catalogue/app/note[15]"> <note15><xsl:apply-templates select="@*|node()"/></note15> </xsl:template> </xsl:stylesheet>

after tranformation looks this:

<?xml version="1.0" encoding="iso-8859-1"?> <catalogue> <app> <action>a</action> <id>308</id> <basevehicle>67</basevehicle> <!-- 1983 porsche 911 --> <bodytype>9</bodytype> <!-- coupe --> <enginebase>15</enginebase> <!-- h6 3.0l --> <note1>oe sensor technology</note1> <qty>1</qty> <parttype>5132</parttype> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position>2172</position> <!-- upstream --> <part>101027</part> </app> <app> <action>a</action> <id>309</id> <basevehicle>67</basevehicle> <!-- 1983 porsche 911 --> <bodytype>10</bodytype> <!-- convertible --> <enginebase>15</enginebase> <!-- h6 3.0l --> <note1>oe sensor technology</note1> <note2>for vehicles without start-stop function</note2> <qty>1</qty> <parttype>5132</parttype> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position>2172</position> <!-- upstream --> <part>101027</part> </app> <app> <action>a</action> <id>310</id> <basevehicle>68</basevehicle> <!-- 1984 porsche 911 --> <enginebase>16</enginebase> <!-- h6 3.2l --> <enginevin>13</enginevin> <!-- b --> <note1>oe sensor technology</note1> <note2>for vehicles without start-stop function</note2> <qty>1</qty> <parttype>5132</parttype> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position>2172</position> <!-- upstream --> <part>103918</part> </app> <app> <action>a</action> <id>311</id> <basevehicle>68</basevehicle> <!-- 1984 porsche 911 --> <enginebase>1778</enginebase> <!-- h6 3.2l --> <aspiration>5</aspiration> <!-- naturally aspirated --> <qty>1</qty> <parttype>5132</parttype> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position>2172</position> <!-- upstream --> <part>103918</part> </app> </catalogue>

the problem when import xml access xslt transformation, elements "aspiration" , "enginevin" aren't imported. when seek import same way excel, works fine. knows why happening access , how solve it? anyway found how solve problem. need add together new app id="0" element names coming in other app-s, aspiration, enginevin, etc... how add together new app id="0" on top of existing data?

xml ms-access xslt import

No comments:

Post a Comment