Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Formatting XML Table of Contents - Newbie

Reply
Thread Tools

Formatting XML Table of Contents - Newbie

 
 
Saravanan
Guest
Posts: n/a
 
      09-08-2004
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"
xmlnssl="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
 
Reply With Quote
 
 
 
 
Vijay Singh
Guest
Posts: n/a
 
      09-08-2004
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

"Saravanan" <(E-Mail Removed)> wrote in message
news:chndpq$cu9$(E-Mail Removed)...
> 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"
> xmlnssl="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



 
Reply With Quote
 
 
 
 
Saravanan
Guest
Posts: n/a
 
      09-08-2004
Thanks Vijay! It's solved
Saravanan

Vijay Singh wrote:

> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding contents on yaml file without overwriting actual contents Kamarulnizam Rahim Ruby 4 01-28-2011 09:10 AM
if innerHTML used twice then it replaces the contents i want it to display all the contents virendra.amritkar@gmail.com Javascript 0 06-29-2007 08:13 AM
Formatting a single line without effecting the entire table with the Text::Table module Mothra Perl Misc 10 03-11-2005 03:56 PM
Newbie: Refresh contents of a div or table cell dlolsen Javascript 2 06-03-2004 09:17 AM
Can I restrict both attribute contents and element contents in schema Don Adams XML 1 03-05-2004 12:48 PM



Advertisments