Create anchoring with Xslt from xml document



I am trying to create html from xml document with Xslt 1.0. In the xml document, there are customers and in the name attribute of some customers there is "see XXXX" information.


Here is the xml document;



<?xml version="1.0" encoding="UTF-8"?>
<customers>
<customer name="Adam Dev" category="A1" phone="1234543" />
<customer name="Jerry Sngiler (see Matt Pcneiv)" category="" phone="" />
<customer name="Heid Schwan" category="B1" phone="121257456" />
<customer name="Matt Pcneiv" category="A2" phone="65656565" />
<customer name="John Lombak" category="A2" phone="787878787" />
<customer name="April Ozil (see Heid Schwan)" category="" phone="" />
<customer name="Terry Hill" category="B1" phone="1212121212" />
</customers>


I want to create anchoring for the "name" attribute to the related xml node in the xml document like below.I mean when a user clicks the Matt Pcneiv on the second node, page jumps to the Matt Pcneiv on the 4.node.Again when a user clicks Heid Schwan on the 6.node , page jumps to the Heid Schwan on 3.node.



<html>
<head>
<style>
table,th,td
{
border:1px solid black;
border-collapse:collapse;
}
th,td
{
padding:5px;
}
</style>
</head>
<body>

<table style="width:600px">
<tr>
<th>Name</th>
<th>Category</th>
<th>Phone</th>
</tr>
<tr>
<td>Adam Dev</td>
<td>A1</td>
<td>1234543</td>
</tr>
<tr>
**<td>Jerry Sngiler (see <a href="#C1">Matt Pcneiv</a>)</td>**
<td></td>
<td></td>
</tr>
<tr>
**<td><a id="C2">Heid Schwan</a></td>**
<td>B1</td>
<td>121257456</td>
</tr>
<tr>
**<td><a id="C1">Matt Pcneiv</a></td>**
<td>A2</td>
<td>65656565</td>
</tr>
<tr>
<td>John Lombak</td>
<td>A2</td>
<td>787878787</td>
</tr>
<tr>
**<td>April Ozil (see <a href="#C2">Heid Schwan</a>)</td>**
<td></td>
<td></td>
</tr>
<tr>
<td>Terry Hill</td>
<td>B1</td>
<td>1212121212</td>
</tr>
</table>
</body>
</html>


How can I do this with xsl?I would appreciate if you could help me. Thanks.


No comments:

Post a Comment