参考我设法给出部分答案的现有问题How to parse NVD CVE XML and import to Database,我需要扩展这个问题(我无法对现有问题发表评论)
我需要将https://nvd.nist.gov/download.cfm中的XML数据导入MS Access。
[编辑]
我想要创建的数据库中的结构如下:
MainTable(条目)
ChildTable(实况REF)
ChildTable(产品)
ChildTable(参考文献)
ChildTable(扫描仪)
但是,例如,段 cvss:base_metrics 中的记录最终位于单独的表中,这不是一个大问题。
以下XML是一个简略但仍然有效的XML集,包含2个条目记录,每个子表不超过3个子记录。
<?xml version='1.0' encoding='UTF-8'?>
<nvd xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.1" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" nvd_xml_version="2.0" pub_date="2016-06-17T05:29:06" xsi:schemaLocation="http://scap.nist.gov/schema/patch/0.1 http://nvd.nist.gov/schema/patch_0.1.xsd http://scap.nist.gov/schema/feed/vulnerability/2.0 http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd http://scap.nist.gov/schema/scap-core/0.1 http://nvd.nist.gov/schema/scap-core_0.1.xsd">
<entry id="CVE-2003-0001">
<vuln:vulnerable-configuration id="http://www.nist.gov/">
<cpe-lang:logical-test operator="OR" negate="false">
<cpe-lang:fact-ref name="cpe:/o:freebsd:freebsd:4.2"/>
<cpe-lang:fact-ref name="cpe:/o:microsoft:windows_2000_terminal_services::sp2"/>
<cpe-lang:fact-ref name="cpe:/o:netbsd:netbsd:1.5"/>
</cpe-lang:logical-test>
</vuln:vulnerable-configuration>
<vuln:vulnerable-software-list>
<vuln:product>cpe:/o:freebsd:freebsd:4.7</vuln:product>
<vuln:product>cpe:/o:linux:linux_kernel:2.4.10</vuln:product>
<vuln:product>cpe:/o:microsoft:windows_2000::sp2:datacenter_server</vuln:product>
</vuln:vulnerable-software-list>
<vuln:cve-id>CVE-2003-0001</vuln:cve-id>
<vuln:published-datetime>2003-01-17T00:00:00.000-05:00</vuln:published-datetime>
<vuln:last-modified-datetime>2016-06-16T21:59:02.180-04:00</vuln:last-modified-datetime>
<vuln:cvss>
<cvss:base_metrics>
<cvss:score>5.0</cvss:score>
<cvss:access-vector>NETWORK</cvss:access-vector>
<cvss:access-complexity>LOW</cvss:access-complexity>
<cvss:source>http://nvd.nist.gov</cvss:source>
<cvss:generated-on-datetime>2016-06-13T11:15:01.477-04:00</cvss:generated-on-datetime>
</cvss:base_metrics>
</vuln:cvss>
<vuln:assessment_check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="http://oval.mitre.org/repository/data/getDef?id=oval:org.mitre.oval:def:2665" name="oval:org.mitre.oval:def:2665"/>
<vuln:cwe id="CWE-200"/>
<vuln:references xml:lang="en" reference_type="VENDOR_ADVISORY">
<vuln:source>CERT-VN</vuln:source>
<vuln:reference href="http://www.kb.cert.org/vuls/id/412115" xml:lang="en">VU#412115</vuln:reference>
</vuln:references>
<vuln:references xml:lang="en" reference_type="UNKNOWN">
<vuln:source>BUGTRAQ</vuln:source>
<vuln:reference href="http://www.securityfocus.com/archive/1/archive/1/307564/30/26270/threaded" xml:lang="en">20030117 Re: More information regarding Etherleak</vuln:reference>
</vuln:references>
<vuln:references xml:lang="en" reference_type="UNKNOWN">
<vuln:source>BUGTRAQ</vuln:source>
<vuln:reference href="http://www.securityfocus.com/archive/1/archive/1/305335/30/26420/threaded" xml:lang="en">20030106 Etherleak: Ethernet frame padding information leakage (A010603-1)</vuln:reference>
</vuln:references>
<vuln:scanner>
<vuln:definition system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="http://oval.mitre.org/repository/data/DownloadDefinition?id=oval:org.mitre.oval:def:2665" name="oval:org.mitre.oval:def:2665"/>
</vuln:scanner>
<vuln:summary>Multiple ethernet Network Interface Card (NIC) device drivers do not pad frames with null bytes, which allows remote attackers to obtain information from previous packets or kernel memory by using malformed packets, as demonstrated by Etherleak.</vuln:summary>
</entry>
<entry id="CVE-2003-0002">
<vuln:vulnerable-configuration id="http://nvd.nist.gov/">
<cpe-lang:logical-test operator="OR" negate="false">
<cpe-lang:fact-ref name="cpe:/a:microsoft:content_management_server:2001"/>
<cpe-lang:fact-ref name="cpe:/a:microsoft:content_management_server:2001:sp1"/>
</cpe-lang:logical-test>
</vuln:vulnerable-configuration>
<vuln:vulnerable-software-list>
<vuln:product>cpe:/a:microsoft:content_management_server:2001</vuln:product>
<vuln:product>cpe:/a:microsoft:content_management_server:2001:sp1</vuln:product>
</vuln:vulnerable-software-list>
<vuln:cve-id>CVE-2003-0002</vuln:cve-id>
<vuln:published-datetime>2003-02-07T00:00:00.000-05:00</vuln:published-datetime>
<vuln:last-modified-datetime>2008-09-10T20:05:22.087-04:00</vuln:last-modified-datetime>
<vuln:cvss>
<cvss:base_metrics>
<cvss:score>6.8</cvss:score>
<cvss:access-vector approximated="true">NETWORK</cvss:access-vector>
<cvss:access-complexity approximated="true">MEDIUM</cvss:access-complexity>
<cvss:authentication approximated="true">NONE</cvss:authentication>
<cvss:generated-on-datetime>2004-01-01T00:00:00.000-05:00</cvss:generated-on-datetime>
</cvss:base_metrics>
</vuln:cvss>
<vuln:security-protection>ALLOWS_OTHER_ACCESS</vuln:security-protection>
<vuln:references xml:lang="en" reference_type="VENDOR_ADVISORY">
<vuln:source>MS</vuln:source>
<vuln:reference href="http://www.microsoft.com/technet/security/bulletin/ms03-002.asp" xml:lang="en">MS03-002</vuln:reference>
</vuln:references>
<vuln:references xml:lang="en" reference_type="VENDOR_ADVISORY">
<vuln:source>XF</vuln:source>
<vuln:reference href="http://www.iss.net/security_center/static/10318.php" xml:lang="en">mcms-manuallogin-reasontxt-xss (10318)</vuln:reference>
</vuln:references>
<vuln:summary>Cross-site scripting vulnerability (XSS) in ManualLogin.asp script for Microsoft Content Management Server (MCMS) 2001 allows remote attackers to execute arbitrary script via the REASONTXT parameter.</vuln:summary>
</entry>
</nvd>
[结束编辑]
我可以导入所有表格,并且我可以添加链接 vuln:cve-id 作为我导入的所有子表的键,除了子表 vuln:易受攻击构型
我有两个主要问题:
我无法导入仅属性元素
当子表具有多个与主表条目相关的记录时,只有XML中的最后一条记录将导入MS Access。 [编辑,现在已解决,见下文,结束编辑]
第一期1)我曾尝试使用以下代码导入属性
<xsl:stylesheet version="1.0" xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.1" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" xsi:schemaLocation="http://scap.nist.gov/schema/patch/0.1 http://nvd.nist.gov/schema/patch_0.1.xsd http://scap.nist.gov/schema/feed/vulnerability/2.0 http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd http://scap.nist.gov/schema/scap-core/0.1 http://nvd.nist.gov/schema/scap-core_0.1.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*">
<xsl:element name="{name()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
只要我不使用名称空间,它就可以工作,但只要我使用XMLNS在XSLT文件中定义名称空间,MS Access就会抛出一个错误,即&#34;前缀&#39; xml&#39 ;和&#39; xmlns&#39;保留供XML使用。&#34;但是,如果我使用以下XSLT并且不尝试将Attribute转换为Element,则可以使用相同的XMLNS命令进行MS Access。
<xsl:stylesheet version="1.0" xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.1" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" xsi:schemaLocation="http://scap.nist.gov/schema/patch/0.1 http://nvd.nist.gov/schema/patch_0.1.xsd http://scap.nist.gov/schema/feed/vulnerability/2.0 http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd http://scap.nist.gov/schema/scap-core/0.1 http://nvd.nist.gov/schema/scap-core_0.1.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<dataroot>
<xsl:apply-templates select="@*|node()"/>
</dataroot>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="entry">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="cpe-lang:logical-test">
<cpe-lang:logical-test>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</cpe-lang:logical-test>
</xsl:template>
<xsl:template match="vuln:vulnerable-configuration">
<vuln:vulnerable-configuration>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</vuln:vulnerable-configuration>
</xsl:template>
<xsl:template match="vuln:vulnerable-software-list">
<vuln:vulnerable-software-list>
<vuln:cve-id><xsl:value-of select="../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</vuln:vulnerable-software-list>
</xsl:template>
<xsl:template match="cvss:base_metrics">
<cvss:base_metrics>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</cvss:base_metrics>
</xsl:template>
<xsl:template match="vuln:references">
<vuln:references>
<vuln:cve-id><xsl:value-of select="../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</vuln:references>
</xsl:template>
<xsl:template match="vuln:scanner">
<vuln:scanner>
<vuln:cve-id><xsl:value-of select="../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</vuln:scanner>
</xsl:template>
问题2)当子表有多个与主表条目相关的记录时,只有XML中的最后一条记录将被导入MS Access。我使用上面的代码导入所有元素。
[编辑] 我现在设法通过更正XSLT文件中的以下代码来解决问题2:
<xsl:template match="Element1">
<Element2>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</Element2>
</xsl:template>
Element1是我的参考点,它包含源XML中的多个子元素。
Element2到/ Element2是生成的XML代码,因此在我的情况下与Element1相同,但是通过选择不同的Element1&amp; Element2可以修改生成的XML的结构。 由../../表示的目录结构跳转是从条目记录中选择和复制 vuln:cve-id 的步骤数。因此,根据您拥有的子元素级别,您可能需要使用../或../../或无。
现在适用于我的代码可以删除大部分记录和子记录,至少我感兴趣的是下面的代码。请注意,它并没有完全按照原始XML提取所有子表,但它确实给了我所需要的东西。我所做的一个简化是所有子表都链接到 vuln:cve-id ,即使源XML在子表中有子表,但我更喜欢更扁平的结构。
<xsl:stylesheet version="1.0" xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.1" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" xsi:schemaLocation="http://scap.nist.gov/schema/patch/0.1 http://nvd.nist.gov/schema/patch_0.1.xsd http://scap.nist.gov/schema/feed/vulnerability/2.0 http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd http://scap.nist.gov/schema/scap-core/0.1 http://nvd.nist.gov/schema/scap-core_0.1.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<dataroot>
<xsl:apply-templates select="@*|node()"/>
</dataroot>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="entry">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="cpe-lang:logical-test">
<cpe-lang:logical-test>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</cpe-lang:logical-test>
</xsl:template>
<xsl:template match="vuln:vulnerable-configuration">
<vuln:vulnerable-configuration>
<vuln:cve-id><xsl:value-of select="../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</vuln:vulnerable-configuration>
</xsl:template>
<xsl:template match="cpe-lang:logical-test">
<cpe-lang:logical-test>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<cpe-lang:logical-test><xsl:value-of select="../cpe-lang:logical-test"/></cpe-lang:logical-test>
<xsl:apply-templates select="@*|node()"/>
</cpe-lang:logical-test>
</xsl:template>
<xsl:template match="cpe-lang:fact-ref">
<cpe-lang:fact-ref>
<vuln:cve-id><xsl:value-of select="../../../vuln:cve-id"/></vuln:cve-id>
<cpe-lang:fact-ref><xsl:value-of select="../cpe-lang:fact-ref"/></cpe-lang:fact-ref>
<xsl:apply-templates select="@*|node()"/>
</cpe-lang:fact-ref>
</xsl:template>
<xsl:template match="vuln:vulnerable-software-list">
<vuln:vulnerable-software-list>
<vuln:cve-id><xsl:value-of select="../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</vuln:vulnerable-software-list>
</xsl:template>
<xsl:template match="vuln:product">
<vuln:product>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<vuln:product><xsl:value-of select="."/></vuln:product>
<xsl:apply-templates select="@*|node()"/>
</vuln:product>
</xsl:template>
<xsl:template match="cvss:base_metrics">
<cvss:base_metrics>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</cvss:base_metrics>
</xsl:template>
<xsl:template match="vuln:references">
<vuln:references>
<vuln:cve-id><xsl:value-of select="../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</vuln:references>
</xsl:template>
<xsl:template match="vuln:scanner">
<vuln:scanner>
<vuln:cve-id><xsl:value-of select="../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="@*|node()"/>
</vuln:scanner>
</xsl:template>
请注意,对于product元素,&#34;。&#34;需要在行
中标识当前节点这是必需的,因为原始XML的结构,它与其他子节点不同。
所以现在只有问题1仍然是我的问题
[结束编辑]
计划是,一旦我将两组代码分开工作,我会将它们组合起来,以便我可以将属性和元素导入MS Access。
非常感谢任何帮助。
答案 0 :(得分:1)
好的,我现在已经找到了自己问题的答案。
NVD XML难以翻译,因为元素和属性嵌套在原始XML的不同级别。
我现在用于导入此代码的代码如下
<xsl:stylesheet version="1.0" xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.1" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" xsi:schemaLocation="http://scap.nist.gov/schema/patch/0.1 http://nvd.nist.gov/schema/patch_0.1.xsd http://scap.nist.gov/schema/feed/vulnerability/2.0 http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd http://scap.nist.gov/schema/scap-core/0.1 http://nvd.nist.gov/schema/scap-core_0.1.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- create a copy of original XML -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<!-- Create "vulnerable-configuration-att" Table -->
<!-- Add "cve-id" to "vulnerable-configuration" Table -->
<!-- adding "id" atribute to element -->
<!-- adding "operator" atribute to element -->
<!-- adding "negate" atribute to element -->
<xsl:template match="@*|vuln:vulnerable-configuration">
<vulnerable-configuration-att>
<vuln:cve-id> <xsl:value-of select="../vuln:cve-id"/> </vuln:cve-id>
<cve-sub-id> <xsl:value-of select="../../vuln:cve-id"/> </cve-sub-id>
<xsl:element name="config-id"> <xsl:value-of select="@id"/> </xsl:element>
<xsl:element name="operator"> <xsl:value-of select="//@operator"/> </xsl:element>
<xsl:element name="negate"> <xsl:value-of select="//@negate"/> </xsl:element>
</vulnerable-configuration-att>
</xsl:template>
<!-- Create "cwe-att" Table -->
<!-- Add "cve-id" to "cwe-att" Table -->
<!-- adding "id" atribute to element -->
<xsl:template match="@*|vuln:cwe">
<cwe-att>
<xsl:apply-templates select="@*|node()"/>
<vuln:cve-id> <xsl:value-of select="../vuln:cve-id"/> </vuln:cve-id>
<vuln:cve-sub-id> <xsl:value-of select="../../vuln:cve-id"/> </vuln:cve-sub-id>
<xsl:element name="cwe-id"> <xsl:value-of select="@id"/> </xsl:element>
</cwe-att>
</xsl:template>
<!-- Create "vuln:definition-att" Table" -->
<!-- Add "cve-id" to "vuln:definition" Table" -->
<!-- adding "system" and "href" atribute to element -->
<xsl:template match="@*|vuln:definition">
<definition-att>
<vuln:cve-id> <xsl:value-of select="../../vuln:cve-id"/> </vuln:cve-id>
<vuln:cve-sub-id> <xsl:value-of select="../../../vuln:cve-id"/> </vuln:cve-sub-id>
<xsl:element name="system"> <xsl:value-of select="@system"/> </xsl:element>
<xsl:element name="href"> <xsl:value-of select="@href"/> </xsl:element>
</definition-att>
</xsl:template>
<!-- Add "cve-id" to "base_metric" Table" -->
<xsl:template match="cvss:base_metrics">
<cvss:base_metrics>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<xsl:apply-templates select="node()"/>
</cvss:base_metrics>
</xsl:template>
<!-- Add "cve-id" to "vuln:references" Table" as well as attributes -->
<!-- adding "reference" to be able to link "reference" Table and "references" Table -->
<xsl:template match="vuln:references">
<vuln:references>
<cve-id> <xsl:value-of select="../vuln:cve-id"/> </cve-id>
<xsl:element name="xml_lang"> <xsl:value-of select="@xml:lang"/> </xsl:element>
<xsl:element name="reference_type"> <xsl:value-of select="@reference_type"/> </xsl:element>
<reference><xsl:value-of select="."/></reference>
<xsl:apply-templates select="node()"/>
</vuln:references>
</xsl:template>
<!-- Create "eference-att" Table" -->
<!-- Add "cve-id" to "reference-att" Table" -->
<!-- adding "xml:lang" , and "href" atribute to element -->
<!-- adding "reference" to be able to link "reference" Table and "references" Table -->
<xsl:template match="@*|vuln:reference">
<reference-att>
<vuln:cve-id> <xsl:value-of select="../../vuln:cve-id"/> </vuln:cve-id>
<xsl:element name="xml_lang"> <xsl:value-of select="@xml:lang"/> </xsl:element>
<xsl:element name="href"> <xsl:value-of select="@href"/> </xsl:element>
<reference><xsl:value-of select="."/></reference>
</reference-att>
</xsl:template>
<!-- Add "cve-id" to "product" Table" -->
<xsl:template match="vuln:product">
<vuln:product>
<vuln:cve-id><xsl:value-of select="../../vuln:cve-id"/></vuln:cve-id>
<vuln:product><xsl:value-of select="."/></vuln:product>
</vuln:product>
</xsl:template>
</xsl:stylesheet>
在不同级别导入属性的挑战是您需要选择一个带有&#34; xsl:模板匹配的参考点&#34;命令,您只能引用原始XML的每个部分一次,因此,如果要导入NVD XML中的所有属性,则需要使用多个XSLT文件并分阶段将不同级别导入MS Access。 下面是导入子表的示例
<xsl:stylesheet version="1.0" xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.1" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" xsi:schemaLocation="http://scap.nist.gov/schema/patch/0.1 http://nvd.nist.gov/schema/patch_0.1.xsd http://scap.nist.gov/schema/feed/vulnerability/2.0 http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd http://scap.nist.gov/schema/scap-core/0.1 http://nvd.nist.gov/schema/scap-core_0.1.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- create a copy of original XML -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<!-- Create "fact-ref-att" Table -->
<!-- Add "cve-id" to "fact-ref-att" Table -->
<!-- adding "name" atribute to element -->
<xsl:template match="@*|cpe-lang:fact-ref">
<fact-ref-att>
<vuln:cve-id> <xsl:value-of select="../../../vuln:cve-id"/> </vuln:cve-id>
<xsl:element name="fact-ref-name"> <xsl:value-of select="//@name"/> </xsl:element>
</fact-ref-att>
</xsl:template>
</xsl:stylesheet>
通过对Access进行第二次导入,现在可以使用事实ref创建一个单独的表,并将其链接到cve-id。一旦在Access中,可以使用cve-id链接两个表。 对于要导入的相关子/父项的每组属性,您需要一个单独的XSLT文件,但如果它们都是相同或不同父项的子项,则它们可以包含在同一个XSLT文件中。只有当您尝试转换嵌套在父级中的子级时才会出现此问题。