在这个基本的XML类中,我完全理解不了,我正在努力弄清楚自己在做什么。我一直在尝试弄清楚如何使用XSLT显示XML文档,使其看起来像这样:
https://i.stack.imgur.com/mdedM.png
我的XML:
<systemMetadata>
<title>Koha</title>
<creator>by Katipo Communications</creator>
<subject>library community, research, information services,public
libraries, bibliographic management, distributed library systems, metadata,
resource discovery, conferences,lectures, workshops</subject>
<description>Koha was one of the the first open-source Integrated Library Systems
It is used and maintained by the worldwide library community.</description>
<date>2000</date>
<type>ILS</type>
<rights>Open-source</rights>
<identifier>http://www.koha.org/</identifier>
</systemMetadata>
<aboutRecord>
<recordCreator>Created by Matthew Weidemann</recordCreator>
<creationDate>on 2018-05-03</creationDate>
</aboutRecord>
非常感谢你的任何想法。
发布于 2018-05-12 00:52:36
为每个条目添加xml声明和游戏、游戏标签。
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
<games>
<game>
<systemMetadata>
<title>Koha</title>...
</aboutRecord>
</game>
</games>然后创建目录xsl表,如下所示:
<?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>
<xsl:for-each select="games/game">
<h1><xsl:value-of select="systemMetadata/title"/></h1>
<h3>by <xsl:value-of select="systemMetadata/creator"/></h3>
<h3><xsl:value-of select="systemMetadata/subject"/></h3>
<p>
<xsl:value-of select="systemMetadata/title"/> <xsl:value-of select="systemMetadata/date"/>
<xsl:value-of select="systemMetadata/type"/> <xsl:value-of select="systemMetadata/description"/>
</p>
<h2><xsl:value-of select="systemMetadata/rights"/></h2>
<br/>
<h2><i>Record created by <xsl:value-of select="aboutRecord/recordCreator"/> on
<xsl:value-of select="aboutRecord/creationDate"/></i></h2>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>https://stackoverflow.com/questions/50296185
复制相似问题