使用XSLT

时间:2018-05-11 18:12:35

标签: html xml xslt tags

我已经被困了几天了,任何帮助都会受到赞赏。我似乎无法弄清楚如何创建一个显示XML文档内容的xslt文档,看起来像这张照片:

how I want to display my XML

这是我的XML:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="digitalLibrarySystem.css"?>
<digitalLibrarySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.pages.drexel.edu/~eom25/657/diglibschema/digitalLibrarySystem.xsd"
xmlns:dc="http://purl.org/dc/elements/1.1/">



<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>

我试图创建一个表,但它似乎并没有起作用。我问我的教授我们是否应该使用一个表来显示这个XML,但是几天没有任何反应,我只是觉得我不知道自己在做什么。

谢谢

1 个答案:

答案 0 :(得分:1)

据推测,您正在尝试通过生成HTML然后在浏览器中查看HTML来实现此目的。 (还有其他方法,例如生成XSL-FO,将其转换为PDF,然后打印PDF。)

您需要做的第一件事是弄清楚要生成的HTML。从您的帖子中不清楚您的问题是在设计HTML时,还是在使用XSLT生成HTML时。我得到的印象是你的问题在于设计HTML(因为没有理由为此使用表格)。

忘记编写任何XSLT代码,直到知道要生成什么HTML为止。手工编写HTML,直到您对它感到满意为止,然后考虑如何从XML创建它。