Skip to content

Navigation in XML File to convert it into HTML using XSLT?

I want to read XML file and generating its HTML using XSLT.
suppose the content of XML is
<Class>
<Student>
<basicInfo>
<Name>Adam<//Name>
<Rollno>004<//Rollno>
<webpage><a href="www.homepage.com">HOME </a> </webpage>
</basicInfo>
<course>
<courseName>English<courseName>
<courseTitle>LNG010<courseTitle>
</course>
</Student>
<Student>
<basicInfo>
<Name>John<//Name>
<Rollno>005<//Rollno>
<webpage> <a href="www.homepage.com">HOME </a> </webpage>
</basicInfo>
<course>
<courseName>FRENCH<courseName>
<courseTitle>LNG012<courseTitle>
</course></Student>
</Class>
I want to convert it into html in such a way that the first form will show the detailed information (include the hyperlink as hyperlink) of first student and if the user press "Next" button it should show the inforamtion about next student only. Plus if some one wants to search information about any specific stduent via his <name> then the query should return his complete <Student> tag information in html.

One Comment

  1. Jake Cigarâ„¢ wrote:

    sounds like a classic school assignment.. and you haven’t even tried.

    shame on you!

    1 start with the identity transform. (search for it)
    2 add transforms for each node, and let xsl do all the looping and calls for you.

    <xsl:template match="Class">
    <html>
    <head>
    <title> … </title>
    <style> …</style>
    </head>
    <xsl:apply-templates />
    </html>
    </xsl:template>

    Sunday, February 21, 2010 at 3:23 pm | Permalink

Post a Comment

Your email is never published nor shared.