Formatting XML Table of Contents - Newbie

Discussion in 'XML' started by Saravanan, Sep 8, 2004.

  1. Saravanan

    Saravanan Guest

    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
     
    Saravanan, Sep 8, 2004
    #1
    1. Advertising

  2. Saravanan

    Vijay Singh Guest

    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" <> wrote in message
    news:chndpq$cu9$...
    > 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
     
    Vijay Singh, Sep 8, 2004
    #2
    1. Advertising

  3. Saravanan

    Saravanan Guest

    (Solved) Re: Formatting XML Table of Contents - Newbie

    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
     
    Saravanan, Sep 8, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page