Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.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
XSLT中的xmlns名称未能正确读取问题未正确转换文件_Xml_Xslt 1.0 - Fatal编程技术网

XSLT中的xmlns名称未能正确读取问题未正确转换文件

XSLT中的xmlns名称未能正确读取问题未正确转换文件,xml,xslt-1.0,Xml,Xslt 1.0,我已经为SSI创建了一个XSLT,用于根据客户机要求将XML转换为XML。 我不太擅长XSLT,试图用网络帮助解决这个问题 现在,如果删除xmlns=,我当前的XLST工作正常”http://www.ofdaxml.org/schema“>线路 但我正在寻找自动修复,因为我不能手动挖掘每次和来源,我们从克林特,所以我不能在源文件中进行更改 因此,我只希望修复XSLT文件中的问题 有人能帮我吗 当前源文件 <?xml version="1.0" encoding="utf-8"?> &

我已经为SSI创建了一个XSLT,用于根据客户机要求将XML转换为XML。 我不太擅长XSLT,试图用网络帮助解决这个问题

现在,如果删除xmlns=,我当前的XLST工作正常”http://www.ofdaxml.org/schema“>线路 但我正在寻找自动修复,因为我不能手动挖掘每次和来源,我们从克林特,所以我不能在源文件中进行更改

因此,我只希望修复XSLT文件中的问题

有人能帮我吗

当前源文件

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xsi:schemaLocation="http://www.ofdaxml.org/schema C:\PROGRA~1    \HMI\XML\OFDAOrder_03_00_00.xsd" xmlns="http://www.ofdaxml.org/schema"     SchemaVersion="03.00.00">
  <Header>
    <Vendor>
      <Enterprise>
        <Code>www.hermanmiller.com</Code>
      </Enterprise>
      <Code>CHM</Code>
    </Vendor>
    <Language>en-US</Language>
    <Currency>CAD</Currency>
  </Header>
  <PurchaseOrder>
    <Project>
      <Title>Imp0.spe</Title>
      <SpecifierFile>
        <Name>W:\Killer\Gwen\E1\It110.xml</Name>
        <SpecifierSoftware Version="104.00">HM specIT</SpecifierSoftware>
      </SpecifierFile>
      <BusinessSoftware>HM specIT version 104.00</BusinessSoftware>
    </Project>
    <Header>
      <PONumber>IT46_Room46110.spe</PONumber>
      <TransactionCode>New</TransactionCode>
      <CreatedDate>2013-11-29</CreatedDate>
      <RequestedDate Type="DeliverOnOrBefore">2011-07-15</RequestedDate>
      <BillType>Dealer</BillType>
      <OrderType>99</OrderType>
      <Contract>
        <Code>CG1615</Code>
        <Description>EP
</Description>
        <SalesVolume Currency="INR">0</SalesVolume>
      </Contract>
    </Header>
    <OrderLineItem>
      <VendorRef EnterpriseRef="www.HM.com">HMI</VendorRef>
      <Status>Complete</Status>
      <Quantity>1</Quantity>
      <LineItemNumber>2</LineItemNumber>
      <SpecItem>
        <Number>46-3620-69</Number>
        <Description>+Stg Case Std Pull 36W 20D CaseHgt 65 5/8H</Description>
        <Catalog>
          <Code>MFS</Code>
        </Catalog>
        <Option Sequence="1">
          <Code>XS</Code>
          <Description>+textured paint on smooth steel</Description>
        </Option>
        <Option Sequence="2">
          <Code>G1</Code>
          <Description>+graphite</Description>
        </Option>
        <Option Sequence="6">
          <Code>B1</Code>
          <Description>+1 -high base</Description>
        </Option>
      </SpecItem>
    </OrderLineItem>
  </PurchaseOrder>
</Envelope>
当前XSLT文件

<xsl:stylesheet 
    version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.ofdaxml.org/schema"> 
<xsl:output method="xml" indent="yes"/> 
<xsl:template match="/Envelope"> 
<PurchaseOrder> 
<xsl:for-each select="PurchaseOrder/OrderLineItem"> 
<OrderLineDetails> 
<VendorRef><xsl:value-of select="VendorRef"/></VendorRef> 
<LineItemNumber><xsl:value-of select="LineItemNumber"/></LineItemNumber> 
<SpecItemNumber><xsl:value-of select="SpecItem/Number"/></SpecItemNumber> 
<SpecItemDesc><xsl:value-of select="SpecItem/Description"/></SpecItemDesc> 
<ITMOptionCode><xsl:value-of select="SpecItem/Option/Code"/></ITMOptionCode> 
<ITMOptionSeq><xsl:value-of select="SpecItem/Option/@Sequence"/></ITMOptionSeq> 
<ITMOptionDesc><xsl:value-of select="SpecItem/Option/Description"/></ITMOptionDesc> 
<ITMOptionCodeDescOld><xsl:value-of select="concat                (' ',SpecItem/Option/Code, ' ',SpecItem/Option/Description)"/></ITMOptionCodeDescOld> 
<ITMOptionCodeDesc>
  <xsl:for-each select="SpecItem/Option">
    <xsl:if test="position() > 1">
      <xsl:text> - </xsl:text>
    </xsl:if>
    <xsl:value-of select="concat(@Sequence, ' - ',Code, ' - ',Description)"/>
  </xsl:for-each>
</ITMOptionCodeDesc> 


</OrderLineDetails> 
</xsl:for-each> 
</PurchaseOrder> 
</xsl:template> 
</xsl:stylesheet>

- 
我已经更改了XSLT文件,但仍然出现错误

当前XSLT

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"     xmlns:ofda="http://www.ofdaxml.org/schema"
 xmlns="http://www.ofdaxml.org/schema" exclude-result-prefixes="ofda">
<xsl:output method="xml" indent="yes"/> 
<xsl:template match="/Envelope"> 
<PurchaseOrder> 
<xsl:for-each select="ofda:PurchaseOrder/OrderLineItem"> 
<OrderLineDetails> 
<VendorRef><xsl:value-of select="ofda:VendorRef"/></VendorRef> 
<LineItemNumber><xsl:value-of select="ofda:LineItemNumber"/></LineItemNumber> 
<SpecItemNumber><xsl:value-of select="ofda:SpecItem/Number"/></SpecItemNumber> 
<SpecItemDesc><xsl:value-of select="ofda:SpecItem/Description"/></SpecItemDesc> 
<ITMOptionCode><xsl:value-of select="ofda:SpecItem/Option/Code"/></ITMOptionCode> 
<ITMOptionSeq><xsl:value-of select="ofda:SpecItem/Option/@Sequence"/></ITMOptionSeq> 
<ITMOptionDesc><xsl:value-of     select="ofda:SpecItem/Option/Description"/></ITMOptionDesc> 
<ITMOptionCodeDescOld><xsl:value-of select="concat                (' ',ofda:SpecItem/Option/Code, ' ',ofda:SpecItem/Option/Description)"/></ITMOptionCodeDescOld> 
<ITMOptionCodeDesc>
  <xsl:for-each select="ofda:SpecItem/Option">
    <xsl:if test="position() > 1">
      <xsl:text> - </xsl:text>
    </xsl:if>
    <xsl:value-of select="concat(@Sequence, ' - ',ofda:Code, ' - ',ofda:Description)"/>
  </xsl:for-each>
</ITMOptionCodeDesc> 

</OrderLineDetails> 
</xsl:for-each> 
</PurchaseOrder> 
</xsl:template> 
</xsl:stylesheet>

- 
电流输出

<?xml version="1.0" encoding="utf-8"?>www.hr.comCHMen-USCADImperialOil_Trailer46_Room46110.speW:\hr\Gwen\E1\ImperialOil_Trailer46110.xmlHMspecITHMspecIT version 104.00ImperialOil_Trailer46_Room46110.speNew2013-11-292011-07-15Dealer99CG1615Exxon Mobil Global Svcs.Co.-CANADA0HMIComplete1160.0060.0018.0018.0015.0015.00FT75.0070.00FT199.+Cable Management TroughHFTHMIComplete121157.001157.00557.93557.93428.09428.09MS63.0051.77846-3620-69+Stg Case Std Pull 36W 20D CaseHgt 65 5/8HMFSXS+textured paint on smooth steelG1+graphiteW+coat rod with 3 shelves (only available with T2 top)KD+keyed differently  blackT2+1 1/4 -high painted metal top with squared edgeB1+1 -high baseHMIComplete131844.001844.00922.00922.00737.60737.60MF605026-3620-4+Lateral File Std Pull 4-High 36W 20DMERXS+textured paint on smooth steelG1+graphiteT1+1 -high painted metal top with squared edgeOH+overhead hinged door 26-1/4NS1+1 shelf totalKD+keyed differently  blackE+fixed front 13-1/89R+side-to-side filing railKD+keyed differently  blackE+fixed front 13-1/89R+side-to-side filing railE+fixed front 13-1/89R+side-to-side filing railCB+counterweightB1+Base 1 in HHMIComplete14626.00626.00194.06194.06162.76162.76UP74.0069.00LW120.20BF+Mobile Pedastool W-Pull 20D B/FHTUSR+3/4-extension roller slides on box drawers  full-extension ball bearing on file drawerXS+textured paint on smooth steelG1+graphite8T+crossing-Pr Cat 118+crossing indigoH1+hand gripKD+keyed differently  black5M+pencil tray in box drawer  2 file converters in file drawerHMIComplete152485.712485.711491.431491.43745.71745.71FT7040NXLR6630E1S+Work Surf Sq-Edge Rectangular Lam 30D 66WBKR28+canyonEdgeWNBaseblackHMIComplete16757.00757.00319.45319.45267.22267.22ZZ64.7057.80Workrite monitor armMonitor arm with extended arm WRT0I@silverHMIComplete17440.00440.00440.00440.00308.00308.00300InstallationInstallation ChargeCHA
www.hr.comCHMen-USCADImperialOil_Trailer46_Room46110.speW:\hr\Gwen\E1\ImperialOil_Trailer46110.xmlhmspecithspecit version 104.00 ImperialOil_Trailer46_Room46110.speNew2013-11-292011-07-15经销商99cG1615埃克森美孚全球Svcs.Co-加拿大0HMComplete 1160.0060.0018.0018.0018.0015.00FT75.00FT199+电缆管理Troughfthmicomplete121157.001157.00557.93557.93428.09428.09MS63.0051.77846-3620-69+Stg外壳标准拉力36W 20D外壳HGT 65 5/8HMFSXS+光滑钢上的纹理漆G1+石墨线+带3个架子的涂层杆(仅适用于T2顶部)KD+键控黑色T2+1 1/4-高涂漆金属顶部,带方形边缘B1+1-高基底HMI完整131844.001844.00922.00922.00737.60737.60MF605026-3620-4+侧锉Std拉力4-高36W 20DMERXS+光滑钢上的纹理漆G1+石墨1+1-高涂漆金属顶部,带方形边缘+高架铰链门26-1/4NS1+1框架KD+键控不同的黑色+固定的前13-1/89R+侧对侧锉削导轨KD+不同的黑色+固定的前13-1/89R+侧对侧锉削导轨+固定的前13-1/89R+侧对侧锉削导轨CB+配重B1+底座1,HHMIComcomplete 14626.00626.00194.06194.06162.76UP74.0069.00LW120.20BF+移动式脚踏板,带20D B/FHTUR+3/4-延长滚轮盒式抽屉上的滑轨文件抽屉上的全加长滚珠轴承XS+光滑钢上的纹理漆G1+石墨8T+交叉点Pr Cat 118+交叉点靛蓝1+手握柄+键控黑色5M+盒式抽屉中的铅笔托盘2文件抽屉中的文件转换器完成152485.712485.711491.431491.43745.71FT7040NXLR6630E1S+工作表面方形边缘Lam 30D 66WBKR28+峡谷边缘基于黑色HMI完成16757.00757.00319.45319.45267.22267.22ZZ64.7057.80Workrite监视器臂带延伸臂的监视器臂WRT0I@silverHMIComplete17440.00440.00440.00440.00308.00308.00300InstallationInstallationChargeCHA

我仍然得到同样的问题,我不知道我丢失了更新文件的哪一部分

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"     xmlns:ofda="http://www.ofdaxml.org/schema"
 xmlns="http://www.ofdaxml.org/schema" exclude-result-prefixes="ofda">
<xsl:output method="xml" indent="yes"/> 
<xsl:template match="ofda:Enveloper"> 

<PurchaseOrder> 
<xsl:for-each select="ofda:PurchaseOrder/OrderLineItem"> 
<OrderLineDetails> 
<VendorRef><xsl:value-of select="ofda:VendorRef"/></VendorRef> 
<LineItemNumber><xsl:value-of select="ofda:LineItemNumber"/></LineItemNumber> 
<SpecItemNumber><xsl:value-of select="ofda:SpecItem/Number"/></SpecItemNumber> 
<SpecItemDesc><xsl:value-of select="ofda:SpecItem/Description"/></SpecItemDesc> 
<ITMOptionCode><xsl:value-of select="ofda:SpecItem/Option/Code"/></ITMOptionCode> 
<ITMOptionSeq><xsl:value-of select="ofda:SpecItem/Option/@Sequence"/></ITMOptionSeq> 
<ITMOptionDesc><xsl:value-of     select="ofda:SpecItem/Option/Description"/></ITMOptionDesc> 
<ITMOptionCodeDescOld><xsl:value-of select="concat            (' ',ofda:SpecItem/Option/Code, ' ',ofda:SpecItem/Option/Description)"/></ITMOptionCodeDescOld> 
<ITMOptionCodeDesc>
      <xsl:for-each select="ofda:SpecItem/Option">
        <xsl:if test="position() > 1">
      <xsl:text> - </xsl:text>
    </xsl:if>
    <xsl:value-of select="concat(@Sequence, ' - ',ofda:Code, ' - ',ofda:Description)"/>
  </xsl:for-each>
</ITMOptionCodeDesc> 

</OrderLineDetails> 
</xsl:for-each> 
</PurchaseOrder> 
</xsl:template> 
    </xsl:stylesheet>

- 

请让我知道我在哪里需要更改

您应该阅读一些关于XML/XSLT和名称空间的文章

您的输入XML具有声明的默认命名空间
xmlns=”http://www.ofdaxml.org/schema“
。这意味着所有未固定的元素都属于此命名空间

因此,还应该在XSLT中声明名称空间。最好加前缀。您现在只将其声明为默认名称空间,但将其作为前缀

改变

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.ofdaxml.org/schema">

我仍然面临这个问题。你们能检查更新的信息并告诉我我仍然丢失的地方吗?你们能检查我过去的XSLT文件吗above@KishorK您需要为属于名称空间的每个名称添加前缀,例如
,等等。默认名称空间应用于文档中的所有元素,而不仅仅是根元素(但它不适用于属性,因此,
@Sequence
应该保持不固定。)嘿,你现在可以检查我的文件了吗?我已经更新了所有的位置,但仍然不工作。现在它工作了。我错过了添加odfa:我刚刚开始添加的每个位置仍然有相同的问题,我不知道我错过了更新文件的哪个部分
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ofda="http://www.ofdaxml.org/schema" xmlns="http://www.ofdaxml.org/schema" exclude-result-prefixes="pfda">
<xsl:template match="/odfa:Envelope"> 
<xsl:for-each select="odfa:PurchaseOrder/odfa:OrderLineItem"> 
<VendorRef><xsl:value-of select="odfa:VendorRef"/></VendorRef>