Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem retrieving the value of <xsl:value-of select="body"...

    Hi,

    I have a problem with an xml/xsl issue. I can't get the value of the 'body' element to display. the value of 'abstract' displays fine but no joy on the body.

    Is body a reserved word or something?

    Any help you could provide would be great.

    Here is a snippet my xml:

    <ci>
    <abstract>Abstract Goes Here</abstract>
    <body>Body Goes Here</body>
    </ci>


    Here is a snippet of my xsl:

    <xsl:template match="/">
    <xsl:for-each select="//ci">
    <h3><xsl:value-of select="title" /></h3>

    <p>
    <xsl:value-of select="abstract" disable-output-escaping="yes" /> &nbsp;<br />
    </p>
    <p>
    <xsl:value-of select="body" disable-output-escaping="yes" /> &nbsp;<br />
    </p>

    </xsl:for-each>
    </xsl:template>

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    put your code between [ code] and [ /code] tags without spaces please. You can edit your post to correct that. Thank you.

    not sure if that will fix the problem, depend of what other template you have before this one, but try this:
    Code:
    <xsl:template match="ci">
    	<h3><xsl:value-of select="title" /></h3>	
    	<p>
    		<xsl:value-of select="abstract" disable-output-escaping="yes" /> &nbsp;<br />
    	</p>		
    	<p>
    		<xsl:value-of select="body" disable-output-escaping="yes" /> &nbsp;<br />
    	</p>	
    </xsl:template>
    Edit: welcome to CF,

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •