创建xml到html的样式表

创建xml到html的样式表,html,xslt,Html,Xslt,我正在尝试创建一个样式表,以html格式格式化qgis元数据(qmd)xml文档。我对这个过程还不熟悉,但我一直在尝试下面的方法,它没有适当地关联样式表 QMD已经 <!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'> <?xml-stylesheet href="Sewerage_Manholes_InspectionShafts.xsl" type="text/xsl" ?> <qgis versi

我正在尝试创建一个样式表,以html格式格式化qgis元数据(qmd)xml文档。我对这个过程还不熟悉,但我一直在尝试下面的方法,它没有适当地关联样式表

QMD已经

<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<?xml-stylesheet href="Sewerage_Manholes_InspectionShafts.xsl" type="text/xsl" ?>
<qgis version="3.9.0-Master">
  <identifier>Z:/My Drive/Mangoesmapping/Spatial Projects/2019/DSC/132_Ongoing_Asset_Updates/Working/Sewerage_Updates/Sewerage_Manholes_InspectionShafts.TAB</identifier>
  <parentidentifier>Sewerage Manhole Infrastructure</parentidentifier>
  <language>AUS</language>
  <type>dataset</type>
  <title>Sewerage Manholes within Douglas Shire Council</title>
  <abstract>Sewerage Manholes within Douglas Shire Council. Most data has been updated based on field work, review of existing AsCon files and discussion with council staff responsible for the assets in 2018/2019. In Port Douglas most of the infrastructure has been surveyed in. </abstract>
  <keywords vocabulary="gmd:topicCategory">
    <keyword>Infrastructure</keyword>
    <keyword>Sewerage</keyword>
  </keywords>
  <keywords vocabulary="undefined 2">
    <keyword>Sewerage</keyword>
  </keywords>
  <keywords vocabulary="undefined 3">
    <keyword>Manholes</keyword>
  </keywords>
  <keywords vocabulary="undefined 4">
    <keyword>Douglas</keyword>
  </keywords>
  <keywords vocabulary="undefined 5">
    <keyword>Queensland</keyword>
  </keywords>
  <contact>
    <name>GIS</name>
    <organization>Douglas Shire Council</organization>
    <position>Finance, Procurement &amp; ICT | Douglas Shire Council</position>
    <voice></voice>
    <fax></fax>
    <email>support.mapping@douglas.qld.gov.au</email>
    <role>Team Leader ICT &amp; Process Improvement</role>
  </contact>
  <links/>
  <history>History</history>
  <fees></fees>
  <rights>Council does not warrant the accuracy of the Data and the Customer
must verify the accuracy of the Data before placing reliance on the Data.</rights>
  <rights>The User indemnifies Council, its employees and agents from any
loss or damage suffered by the Customer or any person or entity, arising
from or in connection with the use/misuse of the Data.</rights>
  <license>The Council is the absolute owner of all intellectual property rights,
including copyright, in the Council’s Data Base (other than DCDB) and
that this Agreement confers no proprietary rights whatsoever in the
Council’s Data Base on the Customer.</license>
  <encoding></encoding>
  <crs>
    <spatialrefsys>
      <proj4>+proj=utm +zone=55 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs</proj4>
      <srsid>2449</srsid>
      <srid>28355</srid>
      <authid>EPSG:28355</authid>
      <description>GDA94 / MGA zone 55</description>
      <projectionacronym>utm</projectionacronym>
      <ellipsoidacronym>GRS80</ellipsoidacronym>
      <geographicflag>false</geographicflag>
    </spatialrefsys>
  </crs>
  <extent>
    <spatial minx="322783.17999999999301508" minz="0" crs="EPSG:28355" maxx="337384.35999999998603016" miny="8170597.66000000014901161" maxz="0" dimensions="2" maxy="8181833.33999999985098839"/>
    <temporal>
      <period>
        <start></start>
        <end></end>
      </period>
    </temporal>
  </extent>
</qgis>

Z:/My Drive/Mangoesmapping/Spatial Projects/2019/DSC/132_Continuous_Asset_Updates/Working/Sewerage_Updates/Sewerage_Shafts_Inspection.TAB
下水道人孔基础设施
澳大利亚
数据集
道格拉斯郡议会内的下水道人孔
道格拉斯郡议会内的下水道人孔。大多数数据已根据现场工作、对现有AsCon文件的审查以及2018/2019年与负责资产的委员会工作人员的讨论进行了更新。在道格拉斯港,大部分基础设施已在年进行了调查。
基础设施
污水处理
污水处理
人孔
道格拉斯
昆士兰
地理信息系统
道格拉斯郡议会
财务,采购及;ICT |道格拉斯郡委员会
支持mapping@douglas.qld.gov.au
资讯及通讯科技小组组长;工艺改进
历史
委员会不保证数据和客户的准确性
在依赖数据之前,必须验证数据的准确性。
用户向委员会、其雇员和代理人赔偿任何损失
客户或任何个人或实体遭受的损失或损害
来自或与数据的使用/误用有关。
理事会是所有知识产权的绝对所有者,
包括理事会数据库(DCDB除外)中的版权,以及
本协议不授予本协议中的任何所有权
委员会的客户数据库。
+项目=utm+区域=55+南部+ellps=GRS80+towgs84=0,0,0,0,0,0+单位=m+无定义
2449
28355
EPSG:28355
GDA94/MGA第55区
utm
GRS80
错误的
xsl具有

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

我的头衔
这应该是标题标签中的值

</head>
<body>
<h1>Keywords: </h1>    
</body>
    <table style="width:100%;"
        <xsl:for-each select="/keywords>
            <tr>
                <td><xsl:value-of select="keyword"/></td>

关键词:
试试这个:-

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
    <html>
        <head>
            <title>
                <xsl:value-of select="//title"/>
            </title>
        </head>
        <body>
            <h1>Keywords: </h1>
        <xsl:for-each select="//keywords">
            <table style="width:100%;">
                <tr>
                    <xsl:for-each select="keyword">
                        <td>
                            <xsl:value-of select="current()"/>
                        </td>
                    </xsl:for-each>
                </tr>
            </table>
        </xsl:for-each>
        <xsl:value-of select="//spatial/@maxx"/>
        </body>
    </html>
</xsl:template>
</xsl:stylesheet>

关键词:

出于安全原因,您的浏览器似乎不会执行转换。最近有很多报告对此表示不满。为了测试通过流程指令附加到XML文档的样式表,您需要为这些样式表运行http服务器。否则,浏览器将无法打开或转换这些由文件url协议提供的文档。@Alejandro-那么,没有http服务器,有没有办法做到这一点呢?我只是按照@GeorgeC之类的教程中的基本流程进行操作,您必须从浏览器配置中禁用该功能。请看示例,有趣的是,上面w3的示例即使不更改配置也可以正常工作,所以我认为这不是问题所在。xml或xsl中有一些东西无法正确连接两者。-谢谢,但格式不正确。如果我将它(qmd或另存为.xml的同一个文件)拖到chrome中,它不会显示任何内容,edge不允许您拖放,firefox只显示所有内容,没有任何格式。我已将这些文件在中提供
        </xsl:for-each>

</html>    
</xsl:template>    
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
    <html>
        <head>
            <title>
                <xsl:value-of select="//title"/>
            </title>
        </head>
        <body>
            <h1>Keywords: </h1>
        <xsl:for-each select="//keywords">
            <table style="width:100%;">
                <tr>
                    <xsl:for-each select="keyword">
                        <td>
                            <xsl:value-of select="current()"/>
                        </td>
                    </xsl:for-each>
                </tr>
            </table>
        </xsl:for-each>
        <xsl:value-of select="//spatial/@maxx"/>
        </body>
    </html>
</xsl:template>
</xsl:stylesheet>