Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 901095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:30:07+00:00 2026-05-15T15:30:07+00:00

I have a problem with my XML that I am trying to display on

  • 0

I have a problem with my XML that I am trying to display on my ASP.NET page that I could do with some help with.
What I would like to do is display it on a multi-line so I have an XML file that looks like this:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="News.xslt" ?>
<newslist>
  <news>
    <date>20th June 2010</date>
    <detail>Detail line 1.
            Detail Line 2</detail>
  </news>
  <news>
    <date>18th June 2010</date>
    <detail>Some more details</detail>
  </news>
</newslist>

And I have an XSLT file that looks like this:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

  <xsl:template match="/">
    <HTML>
      <BODY>
        <xsl:for-each select="newslist/news">
          <xsl:sort select="date" order="descending"/>
          <br />
          <h3><xsl:value-of select="date" /></h3>
          <ul>
            <p><xsl:value-of select="detail" /></p>
          </ul>
        </xsl:for-each>
      </BODY>
    </HTML>
  </xsl:template>
</xsl:stylesheet>

When it displays the first detail line everything is on the same line. I’ve done some digging about and I have tried the following:

  1. xml:space=”preserve” in the XSLT file
  2. in the XML file
  3. <br />
  4. I’ve even tried leaving it as it is.

I am using Microsoft Visual Web Developer 2010. The control I am using is the XML control under the standard tab, and the language I am using is C#, if that helps any.

If this has already been answered and I haven’t found it yet can you please point me at it.

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:30:07+00:00Added an answer on May 15, 2026 at 3:30 pm

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
    
      <xsl:template match="/">
        <HTML>
          <BODY>
            <xsl:for-each select="newslist/news">
              <xsl:sort select="date" order="descending"/>
              <br />
              <h3><xsl:value-of select="date" /></h3>
              <ul>
                <p><xsl:apply-templates select="detail"/></p>
              </ul>
            </xsl:for-each>
          </BODY>
        </HTML>
      </xsl:template>
    
      <xsl:template match="detail/text()" name="textLines">
       <xsl:param name="pText" select="."/>
    
        <xsl:choose>
            <xsl:when test="contains($pText, '&#xA;')">
              <xsl:value-of select="substring-before($pText, '&#xA;')"/>
              <br />
              <xsl:call-template name="textLines">
                <xsl:with-param name="pText" select=
                 "substring-after($pText, '&#xA;')"
                 />
              </xsl:call-template>
            </xsl:when>
            <xsl:otherwise><xsl:value-of select="$pText"/></xsl:otherwise>
        </xsl:choose>
      </xsl:template>
    </xsl:stylesheet>
    

    when applied on the provided XML document:

    <newslist>
      <news>
        <date>20th June 2010</date>
        <detail>Detail line 1.
                Detail Line 2</detail>
      </news>
      <news>
        <date>18th June 2010</date>
        <detail>Some more details</detail>
      </news>
    </newslist>
    

    produces the wanted, correct result:

    <HTML>
        <BODY><br><h3>20th June 2010</h3>
            <ul>
                <p>Detail line 1.<br>            Detail Line 2</p>
            </ul><br><h3>18th June 2010</h3>
            <ul>
                <p>Some more details</p>
            </ul>
        </BODY>
    </HTML>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem in some JavaScript that I am writing where the Switch statement
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am
Here's my problem.I have 2 xmlfiles with identical structure, with the second xml containing
I have an object I can serialize to XML without a problem. However when
My problem is the following. I have a method which simply takes an XML
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for
I have problem when I try insert some data to Informix TEXT column via
I'm trying to set up an XSL:IF statement that only shows entries that have
I have an XML schema that represents a product in a DB, and I
I am trying to add some administration scripts to a Zend Framework project, that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.