Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将此XML数据导入MySQL数据库表?_Php_Mysql_Xml_Database - Fatal编程技术网

Php 如何将此XML数据导入MySQL数据库表?

Php 如何将此XML数据导入MySQL数据库表?,php,mysql,xml,database,Php,Mysql,Xml,Database,为了本地开发的目的,我正在尝试将数据(由管理员导出给我的)从这个XML文件导入到我的phpMyAdmin MySQL数据库表中。除了我不知道怎么做 我查看了loadXMLinfle查询,将XML加载到我在本地数据库中构建的一个表中。然而,当我试图通过查询 LOAD XML INFILE 'D://Secondary/wamp64/tmp/Part_Info.xml' INTO TABLE dbtest.part_no ROWS IDENTIFIED BY '<Row>' 注意:我不

为了本地开发的目的,我正在尝试将数据(由管理员导出给我的)从这个XML文件导入到我的phpMyAdmin MySQL数据库表中。除了我不知道怎么做

我查看了
loadXMLinfle
查询,将XML加载到我在本地数据库中构建的一个表中。然而,当我试图通过查询

LOAD XML INFILE 'D://Secondary/wamp64/tmp/Part_Info.xml'
INTO TABLE dbtest.part_no
ROWS IDENTIFIED BY '<Row>'
注意:我不是在寻找一个数据库表来专门容纳这些数据。我只想将这个.XML文件中的数据存储到本地SQL数据库表中。您可以自由地假设任何表结构,以获得适合您的答案并解决问题。然而,为了展示我自己在解决这一问题上的努力,我使用了以下表格结构:

DROP TABLE IF EXISTS `part_no`;

CREATE TABLE IF NOT EXISTS `part_no` (
  `#` varchar(5) NOT NULL,
  `Part #` varchar(50) DEFAULT NULL,
  `Mfr. Part #` varchar(50) DEFAULT NULL,
  `Mfr. #` varchar(50) DEFAULT NULL,
  `Part Description` varchar(50) DEFAULT NULL,
  `Prime Part #` varchar(50) DEFAULT NULL,
  `PMA` varchar(50) DEFAULT NULL,
  `Key Word` varchar(50) DEFAULT NULL,
  `Part Type` varchar(50) DEFAULT NULL,
  `Planning Type` varchar(50) DEFAULT NULL,
  `Reference Status` varchar(50) DEFAULT NULL,
  `Inventory Status` varchar(4) DEFAULT NULL,
  PRIMARY KEY (`#`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

我想您在尝试导入Excel的XML数据格式时只会遇到悲伤。它实际上只用于在Excel中显示。除非有人在导出之前经历了将列映射到XML字段的麻烦,否则您将无法获得MySQL的有用文件

最简单的解决方案是自己在Excel中打开文件,并将其另存为CSV格式


从这里开始,
LOAD DATA infle
命令功能强大且易于使用,尤其是对于构造良好的CSV文件。

我认为您在尝试导入Excel的XML数据格式时会遇到麻烦。它实际上只用于在Excel中显示。除非有人在导出之前经历了将列映射到XML字段的麻烦,否则您将无法获得MySQL的有用文件

最简单的解决方案是自己在Excel中打开文件,并将其另存为CSV格式


从这里开始,
LOAD DATA infle
命令功能强大且易于使用,特别是对于构造良好的CSV文件。

考虑运行XSLT将原始XML转换为MySQL要求的格式,
LOAD XML infle
。您的原始格式有相当多的名称空间和其他嵌套元素,它们会干扰MySQL上传。与大多数通用语言一样,PHP也配备了XSLT1.0处理器

一个重要的项目是重命名数据库字段名,特别是删除空格、#和句点,以正确匹配xml标记名(甚至遵循RDBMS中的最佳设计实践)

XSLT脚本(另存为下面要引用的.xsl文件)

XML输出(使用此输出文件加载到MySQL,再次相应地重命名列)


1.
444-00522-700
444-00522-700
50010000
指示剂,氧气。高压
444-00522-700
不
组成部分
没有一个
活跃的
0
2.
444-01095-000
444-01095-000
50011658
怒吼
444-01095-000
不
消耗品
再订购级别
活跃的
0
3.
444-01096-000
444-01096-000
50011658
联合
444-01096-000
不
消耗品
再订购级别
活跃的
87
...

考虑运行XSLT,将原始XML转换为MySQL要求的格式,以加载XML填充文件。您的原始格式有相当多的名称空间和其他嵌套元素,它们会干扰MySQL上传。与大多数通用语言一样,PHP也配备了XSLT1.0处理器

一个重要的项目是重命名数据库字段名,特别是删除空格、#和句点,以正确匹配xml标记名(甚至遵循RDBMS中的最佳设计实践)

XSLT脚本(另存为下面要引用的.xsl文件)

XML输出(使用此输出文件加载到MySQL,再次相应地重命名列)


1.
444-00522-700
444-00522-700
50010000
指示剂,氧气。高压
444-00522-700
不
组成部分
没有一个
活跃的
0
2.
444-01095-000
444-01095-000
50011658
怒吼
444-01095-000
不
消耗品
再订购级别
活跃的
0
3.
444-01096-000
444-01096-000
50011658
联合
444-01096-000
不
消耗品
再订购级别
活跃的
87
...

您是否检查了XML文件的权限?它也适用于MySQL。请从这里阅读->@Yahoo谢谢你的建议,但我是本地开发环境数据库的根用户。我是管理员,我完全可以控制操作。你能发布你的表的结构吗?@wchiquito你好。请参考所做的编辑(注释)。支持文档中提到的三种不同的XML格式。您的XML格式比较复杂,所以我不确定加载XML可以实现什么。当然,您可以通过使用来完成所需的任务,但需要做的工作还多一些。您检查过XML文件的权限了吗?它也适用于MySQL。请从这里阅读->@Yahoo谢谢你的建议,但我是本地开发环境数据库的根用户。我是管理员,我完全可以控制操作。你能发布你的表的结构吗?@wchiquito你好。请参考所做的编辑(注释)。支持文档中提到的三种不同的XML格式。您的XML格式比较复杂,所以我不确定加载XML可以实现什么。当然,您可以通过使用来完成所需的工作,但需要做的工作要多一些。我将这个.xml文件保存为.csv文件。接下来,我按照上面提到的步骤进行操作,以确保自己不会搞砸。然而,当我导入数据时,查询运行得很好,但表最终有11行,所有字段都填充了空值(就像从previous.xml导入时一样)。我想我应该联系提供此数据集的管理员。您是否将其保存为逗号分隔或制表符分隔-该示例使用制表符。我工作站上的Excel为我提供了三种类型的“另存为.csv”格式,即.csv(逗号分隔)
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <Author>ANKUR PRAKASH</Author>
  <LastAuthor>Shubham Mehta</LastAuthor>
  <Created>2016-06-10T10:48:33Z</Created>
  <LastSaved>2016-06-10T16:23:58Z</LastSaved>
  <Version>16.00</Version>
 </DocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  <AllowPNG/>
 </OfficeDocumentSettings>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>4455</WindowHeight>
  <WindowWidth>15345</WindowWidth>
  <WindowTopX>0</WindowTopX>
  <WindowTopY>0</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s62">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat ss:Format="0"/>
   <Protection/>
  </Style>
  <Style ss:ID="s63">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat ss:Format="@"/>
   <Protection/>
  </Style>
  <Style ss:ID="s64">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Arial" ss:Bold="1"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s65">
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"
    ss:Bold="1"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="mltvwallinfotbl">
  <Table ss:ExpandedColumnCount="12" ss:ExpandedRowCount="2001" x:FullColumns="1"
   x:FullRows="1" ss:DefaultRowHeight="15">
   <Column ss:StyleID="s62" ss:AutoFitWidth="0"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="92.25"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="102"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="52.5"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="180.75"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="84.75"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="35.25"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="143.25"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="67.5"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="72"/>
   <Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="90.75"/>
   <Column ss:AutoFitWidth="0" ss:Width="81.75"/>
   <Row ss:AutoFitHeight="0">
    <Cell ss:StyleID="s64"><Data ss:Type="String">#</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Part #</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Mfr. Part #</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Mfr. #</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Part Description</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Prime Part #</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">PMA</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Key Word</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Part Type</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Planning Type</Data></Cell>
    <Cell ss:StyleID="s64"><Data ss:Type="String">Reference Status</Data></Cell>
    <Cell ss:StyleID="s65"><Data ss:Type="String">Inventory Status</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">1</Data></Cell>
    <Cell><Data ss:Type="String">444-00522-700</Data></Cell>
    <Cell><Data ss:Type="String">444-00522-700</Data></Cell>
    <Cell><Data ss:Type="String">50010000</Data></Cell>
    <Cell><Data ss:Type="String">INDICATOR,OXYG. HIGH PRESSURE</Data></Cell>
    <Cell><Data ss:Type="String">444-00522-700</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Component</Data></Cell>
    <Cell><Data ss:Type="String">None</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">0</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">2</Data></Cell>
    <Cell><Data ss:Type="String">444-01095-000</Data></Cell>
    <Cell><Data ss:Type="String">444-01095-000</Data></Cell>
    <Cell><Data ss:Type="String">50011658</Data></Cell>
    <Cell><Data ss:Type="String">BELLOWS</Data></Cell>
    <Cell><Data ss:Type="String">444-01095-000</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Expendable</Data></Cell>
    <Cell><Data ss:Type="String">Reorder Level</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">0</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">3</Data></Cell>
    <Cell><Data ss:Type="String">444-01096-000</Data></Cell>
    <Cell><Data ss:Type="String">444-01096-000</Data></Cell>
    <Cell><Data ss:Type="String">50011658</Data></Cell>
    <Cell><Data ss:Type="String">UNION</Data></Cell>
    <Cell><Data ss:Type="String">444-01096-000</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Expendable</Data></Cell>
    <Cell><Data ss:Type="String">Reorder Level</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">87</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">4</Data></Cell>
    <Cell><Data ss:Type="String">444-01298-400</Data></Cell>
    <Cell><Data ss:Type="String">444-01298-400</Data></Cell>
    <Cell><Data ss:Type="String">50010000</Data></Cell>
    <Cell><Data ss:Type="String">ELECTRONIC PR SENSOR MODULE</Data></Cell>
    <Cell><Data ss:Type="String">444-01298-400</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Component</Data></Cell>
    <Cell><Data ss:Type="String">None</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">58</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">5</Data></Cell>
    <Cell><Data ss:Type="String">444-01298-800</Data></Cell>
    <Cell><Data ss:Type="String">444-01298-800</Data></Cell>
    <Cell><Data ss:Type="String">50011658</Data></Cell>
    <Cell><Data ss:Type="String">PR.SENSR</Data></Cell>
    <Cell><Data ss:Type="String">444-01298-400</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Component</Data></Cell>
    <Cell><Data ss:Type="String">None</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">69</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">6</Data></Cell>
    <Cell><Data ss:Type="String">444-01300-300</Data></Cell>
    <Cell><Data ss:Type="String">444-01300-300</Data></Cell>
    <Cell><Data ss:Type="String">50011658</Data></Cell>
    <Cell><Data ss:Type="String">VALVE</Data></Cell>
    <Cell><Data ss:Type="String">444-01300-300</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Expendable</Data></Cell>
    <Cell><Data ss:Type="String">None</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">22</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">7</Data></Cell>
    <Cell><Data ss:Type="String">443W5809JA078</Data></Cell>
    <Cell><Data ss:Type="String">443W5809JA078</Data></Cell>
    <Cell><Data ss:Type="String">50010001</Data></Cell>
    <Cell><Data ss:Type="String">CARPET</Data></Cell>
    <Cell><Data ss:Type="String">443W5809JA078</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Expendable</Data></Cell>
    <Cell><Data ss:Type="String">None</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">48</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">8</Data></Cell>
    <Cell><Data ss:Type="String">443W5809JA079</Data></Cell>
    <Cell><Data ss:Type="String">443W5809JA079</Data></Cell>
    <Cell><Data ss:Type="String">50010001</Data></Cell>
    <Cell><Data ss:Type="String">CARPET</Data></Cell>
    <Cell><Data ss:Type="String">443W5809JA079</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Expendable</Data></Cell>
    <Cell><Data ss:Type="String">None</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">98</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">9</Data></Cell>
    <Cell><Data ss:Type="String">443W7000-7VG</Data></Cell>
    <Cell><Data ss:Type="String">443W7000-7VG</Data></Cell>
    <Cell><Data ss:Type="String">50010001</Data></Cell>
    <Cell><Data ss:Type="String">KICKSTRIP</Data></Cell>
    <Cell><Data ss:Type="String">443W7000-7VG</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Expendable</Data></Cell>
    <Cell><Data ss:Type="String">None</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">25</Data></Cell>
   </Row>
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="Number">10</Data></Cell>
    <Cell><Data ss:Type="String">443W7000-7WD</Data></Cell>
    <Cell><Data ss:Type="String">443W7000-7WD</Data></Cell>
    <Cell><Data ss:Type="String">50010001</Data></Cell>
    <Cell><Data ss:Type="String">KICKSTRIP</Data></Cell>
    <Cell><Data ss:Type="String">443W7000-7WD</Data></Cell>
    <Cell><Data ss:Type="String">No</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">Expendable</Data></Cell>
    <Cell><Data ss:Type="String">None</Data></Cell>
    <Cell><Data ss:Type="String">Active</Data></Cell>
    <Cell ss:Formula="=RANDBETWEEN(0,100)"><Data ss:Type="Number">2</Data></Cell>
   </Row>
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <Unsynced/>
   <Print>
    <ValidPrinterInfo/>
    <PaperSizeIndex>9</PaperSizeIndex>
    <HorizontalResolution>600</HorizontalResolution>
    <VerticalResolution>600</VerticalResolution>
   </Print>
   <Selected/>
   <TopRowVisible>75</TopRowVisible>
   <LeftColumnVisible>2</LeftColumnVisible>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>107</ActiveRow>
     <ActiveCol>4</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
 <ss:DocumentProperties>
   <ss:Author>Ramco Systems Ltd</ss:Author>
   <ss:LastAuthor>Ramco Systems Ltd</ss:LastAuthor>
   <ss:Created>Friday, June 10, 2016</ss:Created>
  </ss:DocumentProperties>
</Workbook>
DROP TABLE IF EXISTS `part_no`;

CREATE TABLE IF NOT EXISTS `part_no` (
  `#` varchar(5) NOT NULL,
  `Part #` varchar(50) DEFAULT NULL,
  `Mfr. Part #` varchar(50) DEFAULT NULL,
  `Mfr. #` varchar(50) DEFAULT NULL,
  `Part Description` varchar(50) DEFAULT NULL,
  `Prime Part #` varchar(50) DEFAULT NULL,
  `PMA` varchar(50) DEFAULT NULL,
  `Key Word` varchar(50) DEFAULT NULL,
  `Part Type` varchar(50) DEFAULT NULL,
  `Planning Type` varchar(50) DEFAULT NULL,
  `Reference Status` varchar(50) DEFAULT NULL,
  `Inventory Status` varchar(4) DEFAULT NULL,
  PRIMARY KEY (`#`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"               
               xmlns:s="urn:schemas-microsoft-com:office:spreadsheet"
               exclude-result-prefixes="s">
<xsl:output version="1.0" encoding="UTF-8" indent="yes" />
<xsl:strip-space elements="*"/>

  <xsl:template match="s:Workbook">
    <data>
      <xsl:apply-templates select="s:Worksheet/s:Table/s:Row[position() &gt; 1]"/>
    </data>
  </xsl:template>

  <xsl:template match="s:Worksheet/s:Table/s:Row[position() &gt; 1]">
    <row>        
        <No><xsl:value-of select="s:Cell[1]/s:Data"/></No>
        <PartNo><xsl:value-of select="s:Cell[2]/s:Data"/></PartNo>
        <MfrPartNo><xsl:value-of select="s:Cell[3]/s:Data"/></MfrPartNo>
        <MfrNo><xsl:value-of select="s:Cell[4]/s:Data"/></MfrNo>
        <PartDescription><xsl:value-of select="s:Cell[5]/s:Data"/></PartDescription>
        <PrimePart><xsl:value-of select="s:Cell[6]/s:Data"/></PrimePart>
        <PMA><xsl:value-of select="s:Cell[7]/s:Data"/></PMA>
        <KeyWord><xsl:value-of select="s:Cell[8]/s:Data"/></KeyWord>
        <PartType><xsl:value-of select="s:Cell[9]/s:Data"/></PartType>
        <PlanningType><xsl:value-of select="s:Cell[10]/s:Data"/></PlanningType>
        <ReferenceStatus><xsl:value-of select="s:Cell[11]/s:Data"/></ReferenceStatus>
        <InventoryStatus><xsl:value-of select="s:Cell[12]/s:Data"/></InventoryStatus>
    </row>
  </xsl:template>
</xsl:transform>
// LOAD XML AND XSL FILES
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->load('Input.xml');

$xslfile = new DOMDocument('1.0', 'UTF-8');
$xslfile->load('XSLTScript.xsl');

// TRANSFORM XML with XSLT
$proc = new XSLTProcessor;
$proc->importStyleSheet($xslfile); 
$newXml = $proc->transformToXML($xml);

// OUTPUT TO FILE
file_put_contents('Output.xml', $newXml);
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <row>
    <No>1</No>
    <PartNo>444-00522-700</PartNo>
    <MfrPartNo>444-00522-700</MfrPartNo>
    <MfrNo>50010000</MfrNo>
    <PartDescription>INDICATOR,OXYG. HIGH PRESSURE</PartDescription>
    <PrimePart>444-00522-700</PrimePart>
    <PMA>No</PMA>
    <KeyWord>Component</KeyWord>
    <PartType>None</PartType>
    <PlanningType>Active</PlanningType>
    <ReferenceStatus>0</ReferenceStatus>
    <InventoryStatus/>
  </row>
  <row>
    <No>2</No>
    <PartNo>444-01095-000</PartNo>
    <MfrPartNo>444-01095-000</MfrPartNo>
    <MfrNo>50011658</MfrNo>
    <PartDescription>BELLOWS</PartDescription>
    <PrimePart>444-01095-000</PrimePart>
    <PMA>No</PMA>
    <KeyWord>Expendable</KeyWord>
    <PartType>Reorder Level</PartType>
    <PlanningType>Active</PlanningType>
    <ReferenceStatus>0</ReferenceStatus>
    <InventoryStatus/>
  </row>
  <row>
    <No>3</No>
    <PartNo>444-01096-000</PartNo>
    <MfrPartNo>444-01096-000</MfrPartNo>
    <MfrNo>50011658</MfrNo>
    <PartDescription>UNION</PartDescription>
    <PrimePart>444-01096-000</PrimePart>
    <PMA>No</PMA>
    <KeyWord>Expendable</KeyWord>
    <PartType>Reorder Level</PartType>
    <PlanningType>Active</PlanningType>
    <ReferenceStatus>87</ReferenceStatus>
    <InventoryStatus/>
  </row>
...
</data>