Formatting XML Table of Contents - Newbie

S

Saravanan

This is my XML file:

<?xml version="1.0" encoding="utf-8" ?>
<Feature>
<Section>Protocol
<Section>Network
</Section>
<Section>HTTP
<Requirements>Header
</Requirements>
<Requirements>Connection
</Requirements>
</Section>
</Section> </Feature>

This is my XSLT file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<HTML>
<BODY>
<br><xsl:for-each select = "Feature">
<xsl:value-of select="Section" />
<xsl:for-each select = "Feature/Section">
<xsl:value-of select="Section" />
<xsl:value-of select="Requirements" />
</xsl:for-each> </br>
</xsl:for-each> </br>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

My XSLT file generates an output that is a stream of text as follows:

Protocol Stack Network Layer TCP TLS/SSL HTTP Request Header Connection
Management Caching Response Code Handling Non-Standard Response Header
Support

But I am trying to get a formatted output similar to the Table of
Contents with indentations that one will find in a text book or
something similar. I am new to XML any input/directions will make my day!

Thanks,
Subash
 
V

Vijay Singh

I suppose you are loading this XML file in the Internet Explorer. Right!!!

If you are doing above then you have to tell Internet Explorer that it
should use your XSLT file to format the output. And for that you need to
reference the XSLT file in your XML file as follows :

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="your style sheet name" ?>
<Feature>
<Section>Protocol
<Section>Network
</Section>
<Section>HTTP
<Requirements>Header
</Requirements>
<Requirements>Connection
</Requirements>
</Section>
</Section>
</Feature>

Vijay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,830
Latest member
HeleneMull

Latest Threads

Top