Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.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
Xml 我认为在XSL中使用名称空间会有问题_Xml_Xslt_Xml Namespaces - Fatal编程技术网

Xml 我认为在XSL中使用名称空间会有问题

Xml 我认为在XSL中使用名称空间会有问题,xml,xslt,xml-namespaces,Xml,Xslt,Xml Namespaces,我有这个问题 我的输出如下所示: <job id=""> <str name="person or company">text</str> <str name="content"> <content> <str name="title"> <h1 xmlns="http://www.w3.org/1999/xhtml"&

我有这个问题

我的输出如下所示:

  <job id="">
      <str name="person or company">text</str>
      <str name="content">
         <content>
            <str name="title">
               <h1 xmlns="http://www.w3.org/1999/xhtml">text</h1>
            </str>
            <str name="detail">
               <p xmlns="http://www.w3.org/1999/xhtml">text</p>
            </str>
那么我这里有个问题:

 <job xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" id="">
      <str name="person or company">text</str>
      <str name="content">
         <content>
            <str name="title">
               <h1>text</h1>
            </str>
            <str name="detail">
               <p>text</p>
            </str>

文本
文本
正文


如何修复它?

我怀疑您的输入元素在XHTML名称空间中,您将它们复制到输出时未做任何更改,但希望删除名称空间。因此,您需要更改复制XHTML输入元素的代码以进行转换,例如

<xsl:template match="xhtml:*">
  <xsl:element name="{local-name()}" namespace="">
    <xsl:apply-templates select="@* | node()"/>
  </xsl:element>
</xsl:template>

将剥离命名空间,然后替换为

<xsl:copy-of select="xhtml:h1"/>

你需要

<xsl:apply-templates select="xhtml:h1"/>

如果没有帮助,您需要共享更多样式表代码。

问题在于
<xsl:copy-of select="xhtml:h1"/>
<xsl:apply-templates select="xhtml:h1"/>