xsl-list
[Top] [All Lists]

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

2007-09-04 05:26:41
Hi!

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>":
<box>
  <card type="person">
    <full-name>Simon Ruf</full-name>
  </card>
  <card type="person">
    <full-name>Elizabeth Noname</full-name>
  </card>
  <card type="person">
    <full-name>Jack</full-name>
  </card>
  <card type="person">
    <full-name>Emanuel Ruf</full-name>
  </card>
</box>

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:
<ul>
  <li id="E">Elizabeth Noname</li>
  <li>Emanuel Ruf</li>
  <li id="J">Jack</li>
  <li id="S">Simon Ruf</li>
</ul>

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.

Thanks,
Simon Ruf

http://simonruf.de/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>