How to access <string> nodes

Discussion in 'XML' started by kumarforu, Apr 6, 2010.

  1. kumarforu

    kumarforu

    Joined:
    Apr 6, 2010
    Messages:
    2
    Likes Received:
    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
     
    kumarforu, Apr 6, 2010
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.