Splurd Posted March 6, 2009 Share Posted March 6, 2009 lets say I got a list of notes, and I'm using template match to organise the data, then I need to do a prev, next for page, to go to the next product page.I know which node I'm in, but I need to somehow get the ID of the previous node...eg <inventory> <product> <prod_id>21</prod_id> <prod_name>peanut butter</prod_name> <prod_price>500</prod_price> </product> <product> <prod_id>453</prod_id> <prod_name>jelly jam</prod_name> <prod_price>200</prod_price> </product> <product> <prod_id>341</prod_id> <prod_name>mystery spread</prod_name> <prod_price>1337</prod_price> </product><inventory> right now using <xsl:template match="xxx"> to go thru them, and using position() gives me a index number, but is there a way to use that to jump around the nodes? Link to comment Share on other sites More sharing options...
boen_robot Posted March 7, 2009 Share Posted March 7, 2009 If your resulting page only ever displays one "product" element, and you need to display something else in order to switch to another element, then you might just generate the next number... I mean, something like that: <xsl:param name="page" select="1" /><xsl:template match="product">...<a href="?p=2">Next page</a></xsl:template> This of course assumes that "p" is a query string variable (a.k.a. GET parameter) that you're then passing to XSLT as the "page" parameter. How you map the querystring variable to the XSLT parameter depends on how are you executing the XSLT - JavaScript, PHP, ASP.NET, etc. Link to comment Share on other sites More sharing options...
Splurd Posted March 10, 2009 Author Share Posted March 10, 2009 sorry but I dont understand you and i dont think that quite solves my issue.I'm using <xsl:tempate > and its matching the nodes in my xml,What I need to do, is when it reaches a specific node (which i check via a if ) it needs to go BACK to the previous node, and take a attribute. then go FORWARD to the next node, and take a attribute, Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.