OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   [xml-dev] xml / xslt problem. (following and preceding sibling)

[ Lists Home | Date Index | Thread Index ]
  • To: "Xml-dev" <xml-dev@lists.xml.org>
  • Subject: [xml-dev] xml / xslt problem. (following and preceding sibling)
  • From: "Gerben Rampaart" <gerben@netmatch.nl>
  • Date: Tue, 2 Nov 2004 17:12:47 +0100
  • Thread-index: AcSZbjW66GiPUk1BTieI+xLTy3MDaQnhz0/w
  • Thread-topic: [xml-dev] xml / xslt problem. (following and 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>




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS