我是 xslt 高级程序的新手。我实际上对从 2 个不同的 xml 文件制作 xslt 有疑问。
以下是我拥有的 2 个 xml 文件。
AHK-authors.xml
<?xml version="1.0" encoding="UTF-8"?>
<chapters>
<chapter no="1">
<head-4>By J. R. Weeramantry</head-4>
</chapter>
<chapter no="2">
<head-4>By Ernest Yang<footnote id="AHK-02.1.fn0" prefix="*">
<footnote-para>I would like to acknowledge and express my gratitude for the assistance provided by my colleagues, Mr. Kevin Hong and Ms. Sharon Leung, in the preparation of this Chapter. All errors and omissions are my own. </footnote-para>
</footnote>
</head-4>
</chapter>
<chapter no="3">
<head-4>By David Bateson and Edmund Wan</head-4>
</chapter>
<chapter no="4">
<head-4>By Timothy Hill and Mark Lin</head-4>
</chapter>
<chapter no="5">
<head-4>By Christopher To<footnote id="AHK-05.1.fn0" prefix="*">
<footnote-para>I would like to acknowledge Alan Tang Siu Lun for his assistance in compiling parts of the Chapter.</footnote-para>
</footnote>
</head-4>
</chapter>
<chapter no="6">
<head-4>By Chiann Bao</head-4>
</chapter>
<chapter no="7">
<head-4>By Justin D’Agostino and Ula Cartwright-Finch</head-4>
</chapter>
<chapter no="8">
<head-4>By Kim M. Rooney</head-4>
</chapter>
<chapter no="9">
<head-4>By Neil Kaplan QC, JP, CBE, SBS and Andrew Aglionby</head-4>
<head-5>[Revised and Updated by William Stone QC, SBS]<footnote id="AHK-09.1.fn0" prefix="*">
<footnote-para>With thanks to summer students Chadwick Wong and Cheryl Leung.</footnote-para>
</footnote>
</head-5>
</chapter>
<chapter no="10">
<head-4>By Frances van Eupen</head-4>
</chapter>
<chapter no="11">
<head-4>By Peter Yuen and John Choong</head-4>
</chapter>
<chapter no="12">
<head-4>By David Bateson and Edmund Wan</head-4>
</chapter>
<chapter no="13">
<head-4>By Teresa Cheng SC<footnote id="AHK-13.1.fn0" prefix="*">
<footnote-para>Special thanks to Andrew Aglionby, Joy Medd and Johnson Tan, co-authors to the first edition of this chapter, as portions of their work has been retained herein.</footnote-para>
</footnote>
</head-4>
</chapter>
<chapter no="14">
<head-4>By Paul Starr<footnote id="AHK-14.1.fn0" prefix="*">
<footnote-para>Heartfelt thanks to Jennifer Lee-Shoy, Stefania Lucchetti, Samuel Tang and Rita Wong.</footnote-para>
</footnote>
</head-4>
</chapter>
<chapter no="15">
<head-4>By Timothy Hill and Mark Lin</head-4>
</chapter>
<chapter no="16">
<head-4>By Denis Brock and Shirley Wu</head-4>
</chapter>
<chapter no="17">
<head-4>By Peter Chow</head-4>
</chapter>
<chapter no="18">
<head-4>By Paul Starr<footnote id="AHK-18.1.fn0" prefix="*">
<footnote-para>Heartfelt thanks to Jennifer Lee-Shoy, Samuel Tang and Rita Wong for their assistance with this chapter.</footnote-para>
</footnote>
</head-4>
</chapter>
<chapter no="19">
<head-4>By Kathryn Sanger, Joseph Chu and Bing Yu</head-4>
</chapter>
<chapter no="20">
<head-4>By Loke-Khoon Tan</head-4>
</chapter>
<chapter no="21">
<head-4>By Philip Yang and Rosita Lau</head-4>
</chapter>
<chapter no="22">
<head-4>By Marianne Chao</head-4>
</chapter>
<chapter no="23">
<head-4>By Dr Nils Eliasson</head-4>
</chapter>
<chapter no="24">
<head-4>Banking, International Investor-State, Insurance, Property and Employment Disputes</head-4>
<head-5>By Frances van Eupen, Vincent Li, Gary Soo and Alexander Stock</head-5>
</chapter>
</chapters>
ARBHK-Chapter01.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="xsl" ref="Untitled28.xslt"?>
<chapter num="A">
<title>
<content-style font-style="bold">PART 1 GENERAL PRINCIPLES</content-style>
</title>
<section level="sect1">
<title>
<content-style font-style="bold">Chapter 1: THE NEW ARBITRATION ORDINANCE</content-style>
</title>
</section>
</chapter>
我试过的xslt如下 Untitled28.xslt
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<xsl:text disable-output-escaping="yes"><![CDATA[</meta>]]></xsl:text>
<title>
<xsl:value-of select="substring-after(chapter/section/title,':')"/>
</title>
<link rel="stylesheet" href="er:#css" type="text/css"/><xsl:text disable-output-escaping="yes"><![CDATA[</link>]]></xsl:text>
</head>
<body>
<xsl:call-template name="new"/>
</body>
</html>
</xsl:template>
<xsl:template match="chapters/chapter" name="new">
<div class="new">
<xsl:apply-templates select="document('AHK-authors.xml')/head-4">
</xsl:apply-templates>
</div>
</xsl:template>
</xsl:stylesheet>
我得到的o/p如下
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</meta>
<title> THE NEW ARBITRATION ORDINANCE</title>
<link rel="stylesheet" href="er:#css" type="text/css"/>
</head>
<body>
<div class="new"/>
</body>
</html>
但我想列出所有作者信息。
请让我知道我该怎么做。
谢谢