#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Posts
    20
    Rep Power
    0

    filtering xml output using xsl for-each select


    I'm having difficulty filtering the xml output below


    computerStore storeName="Mac Store">[code]
    <model picture="images/imac.jpg">[code]
    <name type="desktop">iMac</name>
    <package>A</package>
    <cpu speed="600">600MHz PowerPC G3</cpu>
    <memory mem="128">128MB SDRAM</memory>
    <hd size="40">40GB Ultra ATA drive</hd>
    <drive>CD-ROM</drive>
    <video>Rage 128 Ultra graphics</video>
    <modem>56K internal modem</modem>
    <price>799</price>
    <tax>0.14</tax>
    <shipping>20</shipping>
    </model>
    </computerStore>

    I'm trying to write a stament that selects all desktop computers and its features(name,package, cpu) for each desktop computers

    I created this stament:
    <xsl:for-each select="computerStore/model["name/[@type='desktop']"]"> however its not working.

    What am I doing wrong?

    And another thing, how do I format code when I post on forum?

    Please Help

    getchoo
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    8
    Rep Power
    0
    Hello,

    I hope this will help

    <xsl:for-each select="computerStore/model[name[@type='desktop']]">


    I did not get u regarding the formatting.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Posts
    20
    Rep Power
    0

    Hi thanx it worked....


    Hi

    What I meant by the second question is whenever I paste my code on this forum, the indentations and nesting is not preserved. How do I paste my code on this forum and it looks exactly like my original code.

    Thanx

    getchoo
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    8
    Rep Power
    0
    Hi

    I guess this is something u have to ask the moderator. They could help u in this regard.


    Reem
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    new york
    Posts
    84
    Rep Power
    13
    getchoo,

    try this:

    [ CODE] ...insert code here [ /CODE]

    and remove the space between [ and C
    same for [ and /


    justin.dago();

IMN logo majestic logo threadwatch logo seochat tools logo