View Single Post
  #1 (permalink)  
Old April 9th, 2013, 03:19 AM
sunnykeerthi sunnykeerthi is offline
Authorized User
Points: 151, Level: 3
Points: 151, Level: 3 Points: 151, Level: 3 Points: 151, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 31
Thanks: 3
Thanked 0 Times in 0 Posts
Default XSLT from two XMLs

Hi,
i'm new to xslt advanced program. i actually have a doubt in making an xslt from 2 different xml files.

Below are the 2 xml files i have.

AHK-authors.xml

HTML Code:
<?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

HTML Code:
<?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>

and the xslt i tried is as below
Untitled28.xslt

HTML Code:
<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>
the o/p i'm getting is as below

HTML Code:
<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>
but i want <div class="new"/> to list all the authors information.

please let me know how do i do it.

Thanks