DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Location
    Pittsburgh, PA
    Posts
    2

    Question XML/XSLT nested list

    I have a nested list structure but the bullet point for the first nested item has an idented bullet like I want it too, but it also has another bullet that's not idented like the outer list. I can't figure out what I'm doing wrong. This is my code. If you could help that would be great.

    Code:
     XML:
    
    <MAIN>
    <MSA>
        <MSA_DESC>
          outer item
        </MSA_DESC>
      </MSA>
    
      <MSA>
        <MSA_DESC_SUB>
          <SUB>
            <SUB1_VALUE>
              inner item
            </SUB1_VALUE>
          </SUB>
        </MSA_DESC_SUB>
      </MSA>
    </MAIN>
    
    XSLT:
    
    <span>
                      <ul>
                        <xsl:for-each select="MAIN/MSA">
                          <li>
                            <xsl:value-of select="MSA_DESC"/>
                            <ul>
                              <xsl:for-each select="MSA_DESC_SUB/SUB">
                                <li>
                                  <xsl:value-of select="SUB1_VALUE"/>
                                </li>
                              </xsl:for-each>
                            </ul>
                          </li>
                        </xsl:for-each>
                      </ul>
                    </span>
    It's displaying like this:

    * outer item
    * * inner item

    with the extra bullet on the inner item that I don't want.

  2. #2
    Join Date
    Apr 2010
    Location
    Pittsburgh, PA
    Posts
    2

    Thumbs up XML/XSLT Nested List - Figured it out

    I figured out the dilemma in my previous post. This is what the xml and xslt should look like:

    XML:
    Code:
    <MAIN>
    <MSA>
          <!-- First Outer Item -->
          <MSA_DESC>this is first outer bullet text</MSA_DESC>
    
         <!-- First Inner Item -->
         <MSA_DESC_SUB>
         <SUB1_VALUE>this is first inner bullet text</SUB1_VALUE>
         </MSA_DESC_SUB>
    
         <!-- Second Inner Item -->
         <MSA_DESC_SUB>
         <SUB1_VALUE>this is second inner bullet text</SUB1_VALUE>
         </MSA_DESC_SUB>
    
    </MSA>
    
    <MSA>
             <!-- Second Outer Item -->
              <MSA_DESC>this is second outer bullet text</MSA_DESC>
    </MSA>
    </MAIN>

    XSLT
    Code:
    <span>
                      <ul>
                        <xsl:for-each select="MAIN/MSA">
                          <li>
                            <xsl:value-of select="MSA_DESC"/>
                            <ul>
                              <xsl:for-each select="MSA_DESC_SUB">
                                <li>
                                  <xsl:value-of select="SUB1_VALUE"/>
                                </li>
                              </xsl:for-each>
                            </ul>
                          </li>
                        </xsl:for-each>
                      </ul>
                    </span>

Similar Threads

  1. Java Program Help please
    By tagbith in forum Java
    Replies: 0
    Last Post: 09-22-2007, 04:59 PM
  2. Replies: 0
    Last Post: 10-27-2005, 12:16 AM
  3. Problem with linked lists and iterators
    By white94cam in forum C++
    Replies: 2
    Last Post: 03-30-2005, 11:02 PM
  4. ListBot Going Out of Business
    By Larry Rebich in forum vb.announcements
    Replies: 1
    Last Post: 06-28-2001, 01:22 PM
  5. Replies: 333
    Last Post: 06-19-2001, 09:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links