[xsl] Writing a stylesheet to create another XML Document

Subject: [xsl] Writing a stylesheet to create another XML Document
From: "Kunal H. Parikh" <kunal@xxxxxxxxxx>
Date: Tue, 2 Apr 2002 16:42:19 +1000
Hi!

I am trying to combine two XML Documents:

	Tutorial.xml, and
	Author.xml

using the stylesheet TutorialWithAuthorName.xsl

For starters, I don't even know if my stylesheet will work to include
the Author.xml/AuthorList/Author/Name.

Once I get that sorted, I was wondering if an XML file could be
generated to include the Author.xml/AuthorList/Author/Name ?

Also, will this XML file be "live". I.E. will it change each time the
Author.xml has been changed ?

TIA,

Kunal


The contents of each of the files are:

Tutorial.xml
************
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href=" TutorialWithAuthorName.xsl" ?>

<Tutorial>
	<AuthorList>
		<Author id="1" />
		<Author id="2" />
		<Author id="3" />
		<Author id="4" />
	</AuthorList>
</Tutorial>
************

Author.xml
**********
<?xml version="1.0"?>
<AuthorList>
	<Author id="1">
		<Name>Ms. A B C</Name>
	</Author>
	<Author id="2">
		<Name>Ms. D E F</Name>
	</Author>
	<Author id="3">
		<Name>Ms. G H I</Name>
	</Author>
	<Author id="4">
		<Name>Ms. J K L</Name>
	</Author>
</AuthorList>
**********

TutorialWithAuthorName.xsl
**************************
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
	<xsl:template match="/">
		<xsl:apply-templates
select="document(Author.xml)/AuthorList/Author[@id='1']" />
	</xsl:template>

	<xsl:template match="/AuthorList/Author">
		Author Name <xsl:value-of select="Name" />
	</xsl:template>
</xsl:stylesheet>
**************************


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread