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

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)
steven muench webpage
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

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.