title: Import XML into mc access with transform file in visual basic
body: <p>What I would like to do is have a button import an XML file into ms access with a XSLT file.</p>
  
  <p>Here is my vb code right now (which is kind of a mess, new to this):</p>
  
  <pre class="lang-vb prettyprint-override"><code>Private Function CreateDOM()
      Dim dom
      Set dom = New DOMDocument60
      dom.async = False
      dom.validateOnParse = False
      dom.resolveExternals = False
      Set CreateDOM = dom
  End Function
  
  Private Sub impotr_Click()
      Dim strFileList() As String 'File Array
      Dim strFile As String 'Filename
      Dim intFile As Integer 'File Number
      Dim strPath As String ' Path to file folder
      Dim doc, xsl, out, str
  
      Set doc = CreateDOM
      doc.Load "C:\test\test.xml"
      strPath = "C:\test\"
      strFile = Dir(strPath &amp; "*.XML")
  
      Set xsl = CreateDOM
      xsl.Load "C:\test\transformer.xsl"
  
      While strFile &lt;&gt; ""
             'add files to the list
            intFile = intFile + 1
            ReDim Preserve strFileList(1 To intFile)
            strFileList(intFile) = strFile
            strFile = Dir()
        Wend
  
  
         'see if any files were found
      If intFile = 0 Then
            MsgBox "No files found"
            Exit Sub
      End If
  
        'cycle through the list of files
        For intFile = 1 To UBound(strFileList)
            On Error Resume Next
            Application.ImportXml strPath &amp; strFileList(intFile), 2
  
        Next intFile
  
  
      str = doc.transformNode(xsl)
  
      Set out = CreateDOM
      doc.transformNodeToObject xsl, out
  
      MsgBox "Import Completed"
  End Sub
  </code></pre>
  
  <p>XML file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;iavmNotice xmlns="http://stuff.com" noticeId="138643"&gt;
     &lt;xmlUrl&gt;https://fakexmlurl.xml&lt;/xmlUrl&gt;
     &lt;htmlUrl&gt;https://fakehtmlurl.htm&lt;/htmlUrl&gt;
     &lt;iavmNoticeNumber&gt;2012-B-0080&lt;/iavmNoticeNumber&gt;
     &lt;title&gt;Cisco Vulnerability&lt;/title&gt;
     &lt;type&gt;B&lt;/type&gt;
     &lt;state&gt;FINAL&lt;/state&gt;
     &lt;lastSaved&gt;2012-08-24T10:34:13&lt;/lastSaved&gt;
     &lt;precoordDueDate&gt;2012-08-23T11:00:00&lt;/precoordDueDate&gt;
     &lt;releaseDate&gt;2012-08-23&lt;/releaseDate&gt;
     &lt;acknowledgeDate&gt;2012-08-28&lt;/acknowledgeDate&gt;
     &lt;knownExploits&gt;true&lt;/knownExploits&gt;
     &lt;knownDodIncidents&gt;false&lt;/knownDodIncidents&gt;
     &lt;executiveSummary&gt;Cisco incidents.&lt;/executiveSummary&gt;
     &lt;techOverview&gt;
        &lt;entry&gt;
           &lt;title&gt;2012-2490&lt;/title&gt;
           &lt;description&gt;Cisco ID 71.&lt;/description&gt;
        &lt;/entry&gt;
     &lt;/techOverview&gt;
     &lt;fixAction&gt;Apply appropriate vendor update&lt;/fixAction&gt;
     &lt;note&gt;&amp;lt;b&amp;gt;Upgrade later&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/note&gt;
     &lt;tempMitStrat&gt;
        &lt;header&gt;&amp;lt;b&amp;gt;Cisco &amp;lt;/b&amp;gt;&lt;/header&gt;
        &lt;body&gt;&amp;lt;br&amp;gt;None&lt;/body&gt;
     &lt;/tempMitStrat&gt;
     &lt;vulnAppsSysAndCntrmsrs&gt;Cisco IP Communicator 8.6&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/vulnAppsSysAndCntrmsrs&gt;
     &lt;references&gt;
     &lt;reference&gt;
        &lt;title&gt;Release Notes for Cisco IP Communicator Release 8.6&lt;/title&gt;
        &lt;url&gt;http://www.fakeurl.com/html&lt;/url&gt;
     &lt;/reference&gt;
     &lt;/references&gt;
     &lt;deepSightBids&gt;
        &lt;bid&gt;54850&lt;/bid&gt;
     &lt;/deepSightBids&gt;
     &lt;revisions&gt;
        &lt;revision&gt;
           &lt;majorNum&gt;0&lt;/majorNum&gt;
           &lt;minorNum&gt;0&lt;/minorNum&gt;
           &lt;type&gt;MAJOR&lt;/type&gt;
           &lt;date&gt;2012-08-23&lt;/date&gt;
           &lt;details&gt;Initial Release&lt;/details&gt;
        &lt;/revision&gt;
        &lt;revision&gt;
           &lt;majorNum&gt;0&lt;/majorNum&gt;
           &lt;minorNum&gt;1&lt;/minorNum&gt;
           &lt;type&gt;MINOR&lt;/type&gt;
           &lt;date&gt;2012-08-24&lt;/date&gt;
           &lt;details&gt;Updated Retina Audit&lt;/details&gt;
        &lt;/revision&gt;
     &lt;/revisions&gt;
     &lt;patches&gt;
        &lt;patch&gt;
           &lt;type&gt;V&lt;/type&gt;
           &lt;title&gt;Cisco&lt;/title&gt;
           &lt;url&gt;http://www.fake.com&lt;/url&gt;
        &lt;/patch&gt;
     &lt;/patches&gt;
     &lt;scanners&gt;
        &lt;retina&gt;Audit 2548&lt;/retina&gt;
     &lt;/scanners&gt;
     &lt;vms&gt;
        &lt;stigFindingSeverity&gt;1&lt;/stigFindingSeverity&gt;
        &lt;affectedEnvs&gt;B&lt;/affectedEnvs&gt;
        &lt;posture&gt;1029&lt;/posture&gt;
        &lt;posture&gt;1712&lt;/posture&gt;
        &lt;posture&gt;59&lt;/posture&gt;
     &lt;/vms&gt;
  &lt;/iavmNotice&gt;
  </code></pre>
  
  <p>XSL file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                  xmlns:stuff="http://stuff.com"  exclude-result-prefixes="stuff"&gt;
  &lt;xsl:output version="1.0" encoding="UTF-8" indent="yes" /&gt;
  &lt;xsl:strip-space elements="*"/&gt;
  
    &lt;!-- Identity Transform --&gt;
    &lt;xsl:template match="@*|node()"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select="@*|node()"/&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;  
  
    &lt;xsl:template match="stuff:entry|stuff:tempMitStrat|stuff:reference|stuff:deepSightBids|
                         stuff:revision|stuff:patch|stuff:scanners|stuff:vms"&gt;
      &lt;xsl:copy&gt;      
        &lt;xsl:copy-of select="ancestor::stuff:iavmNotice/stuff:iavmNoticeNumber"/&gt;
        &lt;xsl:apply-templates/&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Everything works when I import it through ms access but I need help with is the visual basic code that will transform the XML then import it.</p>