Problem accessing an element

R

rosemm

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!!!
 
J

Joris Gillis

Tempore 19:57:17 said:
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,
 
R

rosemm

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)<--
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,167
Latest member
SusanaSwan
Top