Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Gerben Rampaart" <gerben@--------.-->
To: "Xml-dev" <xml-dev@-----.---.--->
Date: 11/2/2004 4:13:00 PM
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>


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