[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] following and preceding


Subject: [xsl] following and preceding
From: Meltem Kogelbauer <meltem.kogelbauer@xxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Aug 2001 09:12:09 +0100

Hi all

I have the following xml (simplified) document
<div>
	<id>23</id>
</div>
<accounts>
<element>
	<id>1</id>
</element>
<element>
	<id>2</id>
</element>
<element>
	<id>3</id>
</element>
<element>
	<id>4</id>
</element>
</accounts>
I am looping through the <element> nodes and retreving data from <id> as
well as some others at the same level. I need to pass the id's to the url as
the current id, previous id and the next id. So it follows like
<xsl:for-each select="element">
	<a
href="url&amp;currentid={id}&amp;previousid={preceding::id}&amp;nextid={foll
owing::id}" >name</a>
</xsl:for-each>

Of course I have conditions like if it is the last data in recordset then no
next id and similar to the previous one. This part is not a big problem.

The problem is that "preceding::id" is not returning what I need. The
"following::id" is working well. The "preceding::id" is only returning the
the id on the top level (id=23) and it is constant although I am in the
<element> loop. the <id>'s in the <element> nodes are actually going deeper
in nesting so they are not even at the same level with the top level id
(id=23). I could not figure this out.

Any ideas? Different ways?

Thanks very much in advance

Meltem

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



Current Thread
Keywords
xml