Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate link with XSLT

Tags:

xslt

Hi i've made a php webservice that returns some xml which is transformed into html by an XML file i have . But i want to be able to click on each returned item to get more details about that item. <a href="item.php?id=<?php echo $itemid"?>"> <?php echo $itemname"?> </a> Recently i did the same thing but in PHP, ive tried to use this in XSLT but it doesn't work.

like image 680
SamB09 Avatar asked Dec 28 '22 22:12

SamB09


1 Answers

Use xsl:attribute:

<a>
   <xsl:attribute name="href">item.php?id=<xsl:value-of select="ItemId" /></xsl:attribute>
   <xsl:value-of select="ItemName" />
</a>

Alternatively, the shorter form:

<a href="item.php?id={ItemId}"><xsl:value-of select="ItemName" /></a>

Should also work

like image 172
LorenVS Avatar answered Jan 11 '23 03:01

LorenVS