How to access <string> nodes

Joined
Apr 6, 2010
Messages
2
Reaction score
0
I Used XML Serializer for SubEligBenInfo object using C# and have the following XML.

<SubEligBenInfo>
<sName>Name</sName>
<sMessage>
<string>string 1</string>
<string>string 2</string>
<string xsi:nil="true" />
<string xsi:nil="true" />
<string xsi:nil="true" />
<string xsi:nil="true" />
<string xsi:nil="true" />
<string xsi:nil="true" />
<string xsi:nil="true" />
<string xsi:nil="true" />
</sMessage>

</SubEligBenInfo>

I am trying to print the values of sMessage using the following in XSLT
<xsl:for-each select="sMessage/string">
<xsl:choose>
<xsl:when test="string-length(sMessage/string) &gt; 0">
Message:<xsl:value-of select="sMessage/string"/><br/>
</xsl:when>
<xsl: otherwise></xsl: otherwise>
</xsl:choose>
</xsl:for-each>

But not able to get the Messages on HTML output. Please help me.
Final Output should be like this
Message: String 1
Message: String 2
 

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,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top