[xsl] Generating HTML <link> navigation

Subject: [xsl] Generating HTML <link> navigation
From: "Mario Caprino" <mariocaprino@xxxxxxxxxxx>
Date: Thu, 21 Oct 2004 15:27:14 +0200
Hi,

I am trying to fill the HTML <link rel="next"> and <link rel="prev"> with content through XSLT.
I have a xml document that contains the sorted sequence of the pages. It looks like this;
...
<li id="tinnsoldaten" href="tinnsoldaten.html">The Steadfast Tin Soldier</li>
<li id="klatremusiknipe" href="klatremusiknipe.html">Vole in Trouble</li>
<li id="kariusogbaktus" href="kariusogbaktus.html">Karius and Baktus</li>
<li id="veslefrikk" href="veslefrikk.html">Little Freddy and his Fiddle</li>
...


When processing the the page with the id="klatremusiknipe" I want to fill the link elements like follows;
<link href="tinnsoldaten.html" rel="prev" />
<link href="kariusogbaktus" rel="next" />
... as "tinnsoldaten" is the page listed before the current and "kariusogbaktus" is the one listed just after.


The way I believe I need to go about this is first find the <li> element that has the same id as the page I am processing. Then print out the href attribute of the preceding and following sibling. Sadly my understanding of writing xpath expressions using these axis are weak.

I currently have the following none working solution;

$html-head-link-id= id of the current page being processed
$id-submenu-list= the sorted list of pages described above

These are the expressions that against my will validate to nothing when run...
<xsl:variable name="html-head-link-next" select="$id-submenu-list/following-sibling::li[@id=$html-head-link-id][1]" />
<xsl:variable name="html-head-link-prev" select="$id-submenu-list/preceding-sibling::li[@id=$html-head-link-id][1]" />


Any suggestions to what the correct xpath syntax would be for this case is highly appreciated.
Thank you.


Best regards,
Mario Caprino

_________________________________________________________________
Last ned MSN Messenger gratis http://www.msn.no/computing/messenger - Den raskeste veien mellom deg og dine venner


Current Thread