Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Order of applying templates

From: Helge Luethje <Helge.Luethje@------->
To:
Date: 7/4/2000 10:08:00 AM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent