[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Applying Templates to document loaded with document()

Subject: Applying Templates to document loaded with document() function
From: "Kunal H. Parikh" <kunal@xxxxxxxxxx>
Date: Mon, 15 Apr 2002 11:02:32 +1000
document.loaded
Hi !

I wish to try to match a template in my stylesheet to the nodes selected
from the 'document("Author.xml")'.

I have attached the file structures. Can someone please help ?


TIA,

Kunal


File Structures:

==== Tutorial.xml ====
<?xml version="1.0" encoding="UTF-8" ?>
<Tutorial>
	<AuthorList>
		<Author ID = "ID0001" />
		<Author ID = "ID0002" />
	</AuthorList>

</Tutorial>
==== End of Tutorial.xml ====

==== Author.xml ====
<?xml version="1.0" encoding="UTF-8" ?>
<AuthorList>
	<Author ID = "ID0001">
		<Title>Mr.</Title>
		<FirstName>Kunal</FirstName>
		<LastName>Parikh</LastName>
		<E-MailAddress>String</E-MailAddress>
		<Affiliation>String</Affiliation>
	
<WebsiteAddress>http://www.project42.net</WebsiteAddress>
		<OtherInformation>String</OtherInformation>
	</Author>

	<Author ID = "ID0002">
		<Title>Mr.</Title>
		<FirstName>Kunal</FirstName>
		<LastName>Parikh</LastName>
		<E-MailAddress>String</E-MailAddress>
		<Affiliation>String</Affiliation>
	
<WebsiteAddress>http://www.project42.net</WebsiteAddress>
		<OtherInformation>String</OtherInformation>
	</Author>
</AuthorList>
==== End of Author.xml ====

==== Tutorial.xsl ====
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

	<xsl:import href="Identity.xsl"/>
	<xsl:output method="xml" indent="yes" />
	<xsl:variable name="authors" select="document('Author.xml')" />
	<xsl:key name="authors" match="Author" use="@ID" />

	<xsl:template match="Author">
		<xsl:variable name="ID" select="@ID" />
		<xsl:for-each select="$authors">
			<xsl:copy-of select="key('authors', $ID)" />
		</xsl:for-each>
	</xsl:template>

	<xsl:template match="FirstName">
		<TestElement>SuccessFull</TestElement>
	</xsl:template>

</xsl:stylesheet>
==== End of Tutorial.xsl ====


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.