Automating Further: Adding Next and Previous Links

Being able to create all our files at once was handy, but the resulting pages don't have any navigation on them that lets the user go to another product. Ideally, we want our users to be able to go from one product to the next, or go back, if they want. We can do that by adding a few lines to our program to look forward and backward at the list of products.

We already have one parameter for the product_id being processed. Now, because we'll also be feeding this information to the style sheet, we need parameters for the next and previous products, as in Listing 4.25. We'll also add the links themselves.

Listing 4.25. productpage.xsl: Adding Next and Previous Links
 0:<?xml version="1.0"?> 1:<xsl:stylesheet ...

Get XML and Java™ from scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.