RE: [xsl] Problems with a right order display of tags

Subject: RE: [xsl] Problems with a right order display of tags
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Wed, 31 Mar 2004 11:46:27 +0000
Hi Bertrand,

..
But I must show extract because my XSL and my XML are very large..


My XSL:


<body>
<table border="1">
	<tr>
		<td>

		<xsl:apply-templates
select="/tim/Tache_struct"></xsl:apply-templates>
		<xsl:apply-templates
select="/tim/Tache_struct/Tache_atomique"></xsl:apply-templates>
		<xsl:apply-templates
select="/tim/Tache_struct/Tache_struct"></xsl:apply-templates>

		</td>
	</tr>
	</table>
</body>


What you are saying here is: do templates on all elements "Tache_struct" that have a parent element "tim" which is the root of the document, then do templates on all elements "Tache_atomique" than has "Tache_struct" as parent, which in turn has "tim" as parent (which is root), then do the "Tache_struct" that has "Tache_struct" as parent that has....


In short, you are directing the sequence of processing - first one type of elements, then the next type, then.... Doing things this way will break the original order of the elements.

I would imagine you would want something like:

<body>
<table border="1">
	<tr>
		<td>
		<xsl:apply-templates
select="/tim/Tache_struct"></xsl:apply-templates>
		</td>
	</tr>
	</table>
</body>

<xsl:template name="Tache_struct">
		<xsl:apply-templates/>
</xsl:template>

Then have a template for "Tache_atomique" and one for "Tache_struct", which I presume you have, getting the output that you do.

Regards,
Ragulf Pickaxe :)

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail


Current Thread