Problem accessing an element

Discussion in 'XML' started by rosemm, Jan 21, 2005.

  1. rosemm

    rosemm Guest

    I am having a problem accessing an element in an XML document (one that
    I receive from someone else). The xml looks like this

    <FAMILY>
    <DAD>
    <ADDRESS>
    <ADDRESS_LINE VALUE="SOMETHING"/>
    <ADDRESS_LINE VALUE="SOMETHING ELSE"/>
    ...................
    </ADDRESS>
    <MOM>
    </MOM>
    </FAMILY>
    <FAMILY>
    <DAD>
    <ADDRESS>
    <ADDRESS_LINE VALUE="SOMETHING"/>
    ..............
    </ADDRESS>
    <MOM>
    </MOM>
    </FAMILY>

    I am creating a CSV. I need to have an , , if there is no second
    ADDRESS_LINE. However, I can't even seem to access the second address
    line in my code. Here is what I have so far.


    <xsl:value-of select="normalize-space(ADDRESS_LINE/@VALUE)"/>
    <xsl:text>,</xsl:text>
    <xsl:value-of select="ADDRESS/CITY/@VALUE"/>
    <xsl:text>,</xsl:text>
    <xsl:value-of select="ADDRESS/STATE/@VALUE"/>
    <xsl:text>,</xsl:text>
    <xsl:value-of select="ADDRESS/ZIP/@VALUE"/>
    <xsl:text>,</xsl:text>

    Help!!!
     
    rosemm, Jan 21, 2005
    #1
    1. Advertising

  2. rosemm

    Joris Gillis Guest

    Tempore 19:57:17, die Friday 21 January 2005 AD, hinc in foro {comp.text.xml} scripsit rosemm <>:

    > I am creating a CSV. I need to have an , , if there is no second
    > ADDRESS_LINE. However, I can't even seem to access the second address
    > line in my code. Here is what I have so far.

    Hi,

    Try this:

    <xsl:value-of select="normalize-space(ADDRESS_LINE[1]/@VALUE)"/>
    <xsl:text>,</xsl:text>
    <xsl:value-of select="normalize-space(ADDRESS_LINE[2]/@VALUE)"/>
    <xsl:text>,</xsl:text>
    <xsl:value-of select="ADDRESS/CITY/@VALUE"/>
    <xsl:text>,</xsl:text>
    <xsl:value-of select="ADDRESS/STATE/@VALUE"/>
    <xsl:text>,</xsl:text>
    <xsl:value-of select="ADDRESS/ZIP/@VALUE"/>
    <xsl:text>,</xsl:text>


    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    Fiat W3C !
     
    Joris Gillis, Jan 21, 2005
    #2
    1. Advertising

  3. rosemm

    rosemm Guest

    That doesn't work. I get the following error

    ERROR: Description: Expression must evaluate to a node-set.
    -->normalize-space(ADDRESS/ADDRESS_LINE[1]/@VALUE)<--
     
    rosemm, Jan 21, 2005
    #3
  4. rosemm

    rosemm Guest

    Thanks. I typed something else wrong. That soultion works perfect!!!
     
    rosemm, Jan 21, 2005
    #4
    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.
Similar Threads
  1. MSNews
    Replies:
    1
    Views:
    2,795
    Alvin Bruney [MVP]
    Apr 22, 2004
  2. Rod  Snyder

    moving from form element to form element

    Rod Snyder, May 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    419
    Vidar Petursson
    May 29, 2004
  3. HANM
    Replies:
    2
    Views:
    766
    Joseph Kesselman
    Jan 29, 2008
  4. Christopher Benson-Manica

    Element in a td accessing parent <tr> element

    Christopher Benson-Manica, Mar 30, 2005, in forum: Javascript
    Replies:
    3
    Views:
    151
    Christopher Benson-Manica
    Mar 30, 2005
  5. Iulian Ilea

    problem: create element in create element

    Iulian Ilea, Dec 14, 2006, in forum: Javascript
    Replies:
    4
    Views:
    209
    Iulian Ilea
    Dec 17, 2006
Loading...

Share This Page