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

RE: Resent: Sorting Sibling Nodes !!!

Subject: RE: Resent: Sorting Sibling Nodes !!!
From: "Ciaran Byrne" <ciaran.byrne@xxxxxxx>
Date: Thu, 17 May 2001 20:06:29 +0100
re resent
Sorry....this mail was late getting through....problem fixed ;o)

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Ciaran Byrne
Sent: Thursday, May 17, 2001 10:13 AM
To: Xsl-List
Subject:  Resent: Sorting Sibling Nodes !!!
Importance: High



Hi all,
	I have some content of the form..

<template/><do type="accept"><go href="foo"/></do>

what I want is the following...
if 'do' is a sibling of template(as above) then place 'do'
inside template ie.

<template><do type="accept"><go href="foo"/></do></template>

otherwise leave 'template' as is..

<template></template>.
(NB - I need the output as <template></template> and not <template/>).

I've tried this with the XSL below(Snippet!), However I'm getting duplicate
outputs. Is this because the 'do' gets matched once as a sibling and
a second time when I have <xsl:apply-templates
select="following-sibling::do"/> ?.
In any matter, could someone suggest some ideas ;o)

<!-- ELEMENT do -->
<xsl:template match = "do">
	<xsl:element name="{name()}">
		<xsl:apply-templates/>
	</xsl:element>
</xsl:template>

<!-- ELEMENT template -->
<xsl:template match="template">
	<xsl:choose>
		<xsl:when test="following-sibling::do">
			<xsl:element name="{name()}">
					<xsl:apply-templates select="following-sibling::do"/>
			</xsl:element>
		</xsl:when>
		<xsl:otherwise>
			<xsl:element name="{name()}">
				<xsl:apply-templates/>
			</xsl:element>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

Thanks for the help,
Ciaran.



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



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



 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.