Order of applying templates

Subject: Order of applying templates
From: Helge Luethje <Helge.Luethje@xxxxxxx>
Date: Tue, 4 Jul 2000 08:08:00 +0200 (MEST)
Hi everybody,

sorry, I'm pretty new in the XML/XSL stuff, so the question might be
pretty simple for you.
However, I have an XML file that looks like that:

<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet href="stylesheet.xsl" type="text/xsl" ?>

<Webpage>
	<!-- Title of the web page -->
	<Title>
		Welcome to my Webpage
	</Title>

	<!-- Content of the web page -->
	<Content>
		<Header1>
			Introduction
		</Header1>

		<Text>
			This web page is just for demonstration purposes. There is not really
an introduction....
		</Text>

		<Header1>
			My second Header 1
		</Header1>

		<Header2>
			A smaller Header
		</Header2>

		<Text>
			More text...
		</Text>
	</Content>
</Webpage>

So far so good... But when I use my stylesheet now, the result is that the
order of the page will be messed up. I get all Header1's, all Header2's and
then all Texts. And not as I wanted Header1-Text-Header1-Header2-Text.
What do I have to change in my stylesheet file in order to keep the order
of the XML file?

The XSL file looks like that:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>

<xsl:template match="/">
	<HTML>
	<TITLE>
		<xsl:value-of select="Webpage/Title"/>
	</TITLE>
	<BODY BACKGROUND="bg.gif">
		<xsl:apply-templates select="Webpage/Content"/>
	</BODY>
	</HTML>
</xsl:template>

<xsl:template match="Content">
	<xsl:apply-templates select="Header1"/>
	<xsl:apply-templates select="Header2"/>
	<xsl:apply-templates select="Text"/>
</xsl:template>

<xsl:template match="Header1">
	<H1> <xsl:value-of select="."/> </H1>
</xsl:template>

<xsl:template match="Header2">
	<H3> <xsl:value-of select="."/> </H3>
</xsl:template>

<xsl:template match="Text">
        <P><I>
                <xsl:value-of select="."/>
        </I></P>
</xsl:template>

</xsl:stylesheet>



Thanks for your help! I really appreciate it!
Helge

-- 
Sent through GMX FreeMail - http://www.gmx.net


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


Current Thread