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

xml / xslt problem. (following and preceding sibling)

  • To: "Xml-dev" <xml-dev@l...>
  • Subject: xml / xslt problem. (following and preceding sibling)
  • From: "Gerben Rampaart" <gerben@n...>
  • Date: Tue, 2 Nov 2004 17:12:47 +0100
  • Thread-index: AcSZbjW66GiPUk1BTieI+xLTy3MDaQnhz0/w
  • Thread-topic: xml / xslt problem. (following and preceding sibling)

xslt preceding sibling
Dear all, I have a transformation problem, I made it very simple to
reproduce.

Problem: unexpected behaviour of the preceding-sibling node.

Output of the transformation (with the xml and xslt in this e-mail):
Akropol1
Aegean Holiday Village1
Club Paradiso

Expected output:
Akropol1
Aegean Holiday Village1
Club Paradiso1

Reason of this behaviour: ??

Anybody? Even Kay's XSLT 2e edition didn't help me out and it usually
does. It's probably something simple, but right now, I have no idea.

This is my xslt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" omit-xml-declaration="yes"
version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:param name="entity-id">5</xsl:param>
	<xsl:template match="/">
		<xsl:apply-templates select="content-structure/ent[@par
= 2]"/>
	</xsl:template>
	<xsl:template match="content-structure/ent">
		<xsl:for-each select="ent/ent/ent/ent/ent[@acc =
$entity-id]">
			<xsl:value-of select="@name"/>
			<br/>
			<xsl:value-of
select="following-sibling::ent/@name"/>
			<br/>
			<xsl:value-of
select="preceding-sibling::ent/@name"/>
			<br/>
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>

This is my xml:
<?xml version="1.0" encoding="utf-8"?>
<content-structure>
	<ent par="2" name="Europa">
		<ent cou="2" name="Turkije">
			<ent are="3" name="Turkse Riviera">
				<ent reg="3" name="Turkse Riviera">
					<ent des="11" name="Alanya">
						<ent acc="1" name="Club
Paradiso"/>
						<ent acc="2"
name="Akropolgf"/>
						<ent acc="3"
name="Aegean Holiday Village"/>
						<ent acc="4" name="Club
Paradiso1"/>
						<ent acc="5"
name="Akropol1"/>
						<ent acc="6"
name="Aegean Holiday Village1"/>
						<ent acc="7" name="Club
Paradiso2"/>
						<ent acc="8"
name="Akropol2"/>
						<ent acc="9"
name="Aegean Holiday Village2"/>
					</ent>
				</ent>
			</ent>
		</ent>
	</ent>
</content-structure>

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.