SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: XSLT order

Hybrid View

  1. #1
    SitePoint Evangelist jkh1978's Avatar
    Join Date
    May 2001
    Location
    Northern Virginia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XSLT order

    Im getting sports scores from a XML file. I want to only show the West league, then only the East league. How would i apply the template to only a specific league, then do the other league?

    Also, the way the games are displayed for each league is different. How can I call a different template to output the games for each league?

    <Games data="05/10/2002">
    <Game>
    <League>East</League>
    <Home>
    <Team>Red</Team>
    <Score>5</Score>
    </Home>
    <Away>
    <Team>Green</Team>
    <Score>2</Score>
    </Away>
    </Game>
    <Game>
    <League>West</League>
    <Home>
    <Team>Yellow</Team>
    <Score>3</Score>
    </Home>
    <Away>
    <Team>Blue</Team>
    <Score>2</Score>
    </Away>
    </Game>
    <Game>
    <League>East</League>
    <Home>
    <Team>Purple</Team>
    <Score>5</Score>
    </Home>
    <Away>
    <Team>Pink</Team>
    <Score>0</Score>
    </Away>
    </Game>
    .....
    </Games>

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This XPath should do the trick (to select the nodes where the League attribute is "East"):

    Code:
    /Games/Game/League[@League="East"]
    (the reset is elementary, my dear Watson)


    M@rco


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
  •