【发布时间】:2018-05-13 11:50:36
【问题描述】:
我是 XML 新手,希望得到一点反馈。我正在尝试显示我的 XML,使其看起来像这样:
How I hope to get my XML to display
我似乎无法让元素显示在模板中。 (显然,我没有正确构建它们)。我如何让标题元素 (Koha) 像示例中那样显示为粗体和更大?我只是感觉有点卡住了,我的教授很忙,我希望有人能就下一步做什么提供建议?
我的 XML:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<digitalLibrarySystem xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.pages.drexel.edu/~eom25/657/diglibschema/digitalLibrarySystem.xsd">
<systemMetadata>
<title>Koha</title>
<creator>by Katipo Communications</creator>
<subject>public libraries</subject>
<subject>bibliographic managemen</subject>
<subject>distributed library systems</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 xlink:type="simple" xlink:href="http://http://www.koha.org/">http://www.http://www.koha.org/</identifier>
</systemMetadata>
<aboutRecord>
<recordCreator>Matthew Weidemann</recordCreator>
<creationDate>May 6, 2018</creationDate>
</aboutRecord>
到目前为止我的 XSLT:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h1>"font-weight:bold"><xsl:value-of select="title"/></h1>
<h2>by <xsl:value-of select="systemMetadata/creator"/></h2>
<h3><xsl:value-of select="systemMetadata/subject"/></h3>
<br/>
<p>
<h4><xsl:value-of select="systemMetadata/description"/></h4>
<br/>
</p>
<h5><xsl:value-of select="systemMetadata/rights"/></h5>
<br/>
<h6><i>Record created by <xsl:value-of
select="aboutRecord/recordCreator"/> on
<xsl:value-of select="aboutRecord/creationDate"/></i></h6>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
我对我认为的 XPath 感到困惑,任何建议都有帮助。
【问题讨论】: