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
我正在尝试使用ApacheModXSLT将xml文档转换为html网页_Xml_Xslt_Xhtml - Fatal编程技术网

我正在尝试使用ApacheModXSLT将xml文档转换为html网页

我正在尝试使用ApacheModXSLT将xml文档转换为html网页,xml,xslt,xhtml,Xml,Xslt,Xhtml,这是我的xml文档 <?xml version="1.0" encoding="ISO-8859-15"?> <?xml-stylesheet type="txt/xsl" "href"="demo1.xsl"?> <demo> <root> <_shards> <total>1</total> <failed>0</fai

这是我的xml文档

<?xml version="1.0" encoding="ISO-8859-15"?>
<?xml-stylesheet type="txt/xsl" "href"="demo1.xsl"?>
<demo>
    <root>
        <_shards>
            <total>1</total>
            <failed>0</failed>
            <successful>1</successful>
        </_shards>
        <hits>
            <hits>
                <highlight>
Hadoop Cloudera Hortonworks Other Search and Big Data Partners Products Technology Overview <em>Aspire</em> Content Representative Customers Case Studies Resources Blog White Papers Videos <em>Aspire</em> Downloads <em>Aspire</em> Wiki Technical Briefs Company Introducing Search Technologies Executive Team Partners Press
                </highlight>
                <_index>newindex3</_index>
                <_type>SearchTech</_type>
                <_id>http://www.searchtechnologies.com/support</_id>
                <_score>0.1789403</_score>
                <fields>
                    <keywords>keywords-NOT-PROVIDED</keywords>
                    <title>Search Technologies</title>
                    <url>http://www.searchtechnologies.com/support</url>
                </fields>
            </hits>
            <hits>
                <highlight>
Hadoop Cloudera Hortonworks Other Search and Big Data Partners Products Technology Overview <em>Aspire</em> Content Representative Customers Case Studies Resources Blog White Papers Videos <em>Aspire</em> Downloads <em>Aspire</em> Wiki Technical Briefs Company Introducing Search Technologies Executive Team Partners Press
                </highlight>
                <_index>newindex3</_index>
                <_type>SearchTech</_type>
                <_id>http://www.searchtechnologies.com/</_id>
                <_score>0.1491169</_score>
                <fields>
                    <keywords>
Enterprise Search, Big Data, Analytics, Consulting, Search Engine Experts, Big Data Services
                    </keywords>
                    <title>Enterprise Search and Big Data Experts</title>
                    <url>http://www.searchtechnologies.com/</url>
                </fields>
            </hits>
            <total>2</total>
            <max_score>0.1789403</max_score>
        </hits>
        <took>3</took>
        <timed_out>false</timed_out>
    </root>
</demo>

1.
0
1.
Hadoop Cloudera Hortonworks其他搜索和大数据合作伙伴产品技术概述Aspire内容代表客户案例研究资源博客白皮书视频Aspire下载Aspire Wiki技术简报公司介绍搜索技术执行团队合作伙伴出版社
新索引3
搜索技术
http://www.searchtechnologies.com/support
0.1789403
未提供关键字
搜索技术
http://www.searchtechnologies.com/support
Hadoop Cloudera Hortonworks其他搜索和大数据合作伙伴产品技术概述Aspire内容代表客户案例研究资源博客白皮书视频Aspire下载Aspire Wiki技术简报公司介绍搜索技术执行团队合作伙伴出版社
新索引3
搜索技术
http://www.searchtechnologies.com/
0.1491169
企业搜索、大数据、分析、咨询、搜索引擎专家、大数据服务
企业搜索和大数据专家
http://www.searchtechnologies.com/
2.
0.1789403
3.
假的
这是我的xslt代码。我正在尝试从xml中只筛选突出显示字段。match属性用于将模板与XML元素关联

    <?xml version="1.0" encoding="UTF-8"?>
        <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

        <xsl:template match="/">
          <html>
          <body>
          <h2>My DEMO</h2>
          <table border="1">
            <tr bgcolor="#9acd32">
              <th>highlight</th>
            </tr>
            <xsl:for-each select="demo/root/hits/hits">
            <tr>
              <td><xsl:value-of select="highlight"/></td>
            </tr>
            </xsl:for-each>
          </table>
          </body>
          </html>
        </xsl:template>

        </xsl:stylesheet>

我的演示
突出
当我转到我的服务器时: 我收到一个错误,“此XML文件似乎没有任何与之关联的样式信息”

我进行了更正并将“txt”转换为“文本”,现在当我转到服务器时,我得到了以下输出,而不是html网页

此XML文件似乎没有任何与之关联的样式信息。文档树如下所示

<?xml-stylesheet type="text/xsl" "href"="demo1.xsl"?>
<demo>
<root>
<_shards>
<total>1</total>
<failed>0</failed>
<successful>1</successful>
</_shards>
<hits>
<hits>
<highlight>
Hadoop Cloudera Hortonworks Other Search and Big Data Partners Products Technology Overview
<em>Aspire</em>
Content Representative Customers Case Studies Resources Blog White Papers Videos
<em>Aspire</em>
Downloads
<em>Aspire</em>
Wiki Technical Briefs Company Introducing Search Technologies Executive Team Partners Press
</highlight>
<_index>newindex3</_index>
<_type>SearchTech</_type>
<_id>http://www.searchtechnologies.com/support</_id>
<_score>0.1789403</_score>
<fields>
<keywords>keywords-NOT-PROVIDED</keywords>
<title>Search Technologies</title>
<url>http://www.searchtechnologies.com/support</url>
</fields>
</hits>
<hits>
<highlight>
Hadoop Cloudera Hortonworks Other Search and Big Data Partners Products Technology Overview
<em>Aspire</em>
Content Representative Customers Case Studies Resources Blog White Papers Videos
<em>Aspire</em>
Downloads
<em>Aspire</em>
Wiki Technical Briefs Company Introducing Search Technologies Executive Team Partners Press
</highlight>
<_index>newindex3</_index>
<_type>SearchTech</_type>
<_id>http://www.searchtechnologies.com/</_id>
<_score>0.1491169</_score>
<fields>
<keywords>
Enterprise Search, Big Data, Analytics, Consulting, Search Engine Experts, Big Data Services
</keywords>
<title>Enterprise Search and Big Dataà Experts</title>
<url>http://www.searchtechnologies.com/</url>
</fields>
</hits>
<total>2</total>
<max_score>0.1789403</max_score>
</hits>
<took>3</took>
<timed_out>false</timed_out>
</root>
</demo>

1.
0
1.
Hadoop Cloudera Hortonworks其他搜索和大数据合作伙伴产品技术概述
渴望
内容代表客户案例研究资源博客白皮书视频
渴望
下载
渴望
Wiki技术简报公司介绍搜索技术执行团队合作伙伴出版社
新索引3
搜索技术
http://www.searchtechnologies.com/support
0.1789403
未提供关键字
搜索技术
http://www.searchtechnologies.com/support
Hadoop Cloudera Hortonworks其他搜索和大数据合作伙伴产品技术概述
渴望
内容代表客户案例研究资源博客白皮书视频
渴望
下载
渴望
Wiki技术简报公司介绍搜索技术执行团队合作伙伴出版社
新索引3
搜索技术
http://www.searchtechnologies.com/
0.1491169
企业搜索、大数据、分析、咨询、搜索引擎专家、大数据服务
企业搜索和大数据专家
http://www.searchtechnologies.com/
2.
0.1789403
3.
假的

您在
Hadoop Cloudera Hortonworks其他搜索&Big…
中的输入不是格式良好的XML,需要将其转义为
Hadoop Cloudera Hortonworks其他搜索&;大…
。因此,在能够使用诸如XSLT之类的XML工具处理输入之前,您需要将其固定为格式良好的输入


另请将
更正为

“以下是第一个错误之前的页面呈现”--您是否忘记在您的帖子中包含XML?我编辑了我的XML文件,并将“&”替换为“and”,但现在我得到的是一个XML文件作为输出,而不是html网页。请参阅我的编辑,您的处理指令中有错误。@MrLister,谢谢,这是发布代码中的另一个问题,我没有注意到,现在已修复。@MrLister请检查我编辑的帖子。我已经将“txt”转换为“文本”,但仍然得到一个XML输出,而不是HTML。@MartinHonnen感谢您的回复。请查看我编辑的帖子。