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

RE: [sly] Applying Templates to document loaded with d

Subject: RE: [sly] Applying Templates to document loaded with document() function
From: "Kunal H. Parikh" <kunal@xxxxxxxxxx>
Date: Mon, 15 Apr 2002 23:23:07 +1000
sly templates
Hi !

Thanks for your reply !

But, I think I posed the question incorrectly, thinking, it was the same
situation.

Here is what I really am trying to do.

I have another XML files called stage.xml which refers to Authors and I
wish to apply the template of Authors to the nodes in
StageList/Stage/Author.

I have updated the contents of stage.xml, tutorial.xsl, tutorial.xml.

TIA,

Kunal

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

	<StageList>
		<Stage ID = "ID0001" />
		<Stage ID = "ID0002" />
	</StageList>
</Tutorial>
==== End of Tutorial.xml ====

==== Stage.xml ====
<StageList>
	<Stage ID = "ID0001">
		<AuthorList>
			<Author ID = "ID0001" />
			<Author ID = "ID0002" />
		</AuthorList>
	</Stage>
	<Stage ID = "ID0002">
		<AuthorList>
			<Author ID = "ID0001" />
			<Author ID = "ID0002" />
		</AuthorList>
	</Stage>
</StageList>

==== End of Stage.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:variable name="stages" select="document('Stage.xml')" />
	<xsl:key name="stages" match="Stage" 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="Stage">
		<xsl:variable name="ID" select="@ID" />
		<xsl:for-each select="$stages">
			<xsl:copy-of select="key('stages', $ID)" />
		</xsl:for-each>
	</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.