[xsl] access to preceding-sibling in a sorted list

Subject: [xsl] access to preceding-sibling in a sorted list
From: "Simon Ruf" <ruf.simon@xxxxxxxxx>
Date: Tue, 4 Sep 2007 14:26:39 +0200

I'm using xslt 1 with PHP to create a XHTML output for a address book
stored in my own (I can change it, if necessary) xml format which
looks basically like this (will be around 500 "<card>":
  <card type="person">
    <full-name>Simon Ruf</full-name>
  <card type="person">
    <full-name>Elizabeth Noname</full-name>
  <card type="person">
  <card type="person">
    <full-name>Emanuel Ruf</full-name>

The Ouput is a long sorted (by xsl:sort) <ul>-List. I'd like to jump
to the entries beginning with "e" by an xhtml-anchor. For that I need
to put an id="E" to the first entry beginning with e. In the end it
should look like this:
  <li id="E">Elizabeth Noname</li>
  <li>Emanuel Ruf</li>
  <li id="J">Jack</li>
  <li id="S">Simon Ruf</li>

I've tried to achieve this by saving the current first letter to a
xsl:param but I couldn't change the value of the global parameter from
within the template.
Then I tried to access the value of the preceding sibling but this
would only get me the values of the preceding sibling in the
unsorted-list. (e.g. while processing the card of Emanuel Ruf it would
get me the value "Jack" instead of "Elizabeth Noname")

If there's a way please let me know.

Simon Ruf


Current Thread