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

  • SEARCH
  • Home
  • 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 8060807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:06:54+00:00 2026-06-05T10:06:54+00:00

I transform an XML file to HTML via XSL. In my html-table I have

  • 0

I transform an XML file to HTML via XSL.
In my html-table I have a column where I need to break the cell’s content to a new line for each entry in one of my xml element-tags.

I’m not sure how to set up the xml-file for this.
Here’s the output I was thinking of for my html-file:

<info>
line1<br/>
line2<br/>
line3<br/>
line4
</info>

and what doesn’t work for me on the xsl-part:

    <td>
    <xsl:for-each select="info">
    <xsl:value-of select="." /> <br/>
    </xsl:for-each>
    </td>

I’ve tried wrapping the lines in the xml with <ul> and <li> but that didn’t work. I think it’s the xsl-part where I have the error. If I put a <br/> after the value-of statement it will output everything and then add the <br/> but of course I want the <br/> for each entry.

I hope you can tell me of a way how to set this up correctly.

  • 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-06-05T10:06:55+00:00Added an answer on June 5, 2026 at 10:06 am

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="info/*[position() > 1]">
      <br /><xsl:text>&#xA;</xsl:text>
      <xsl:value-of select="."/>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on the following XML document (as no source XML document is provided in the question):

    <info>
      <t>line1</t>
      <t>line2</t>
      <t>line3</t>
      <t>line4</t>
      <t>line5</t>
    </info>
    

    produces the wanted result (<info> intentionally not generated as this isn’t an HTML element):

    line1<br/>
    line2<br/>
    line3<br/>
    line4<br/>
    line5
    

    Note 1: This transformation was verified to produce exactly the above result with all of my XSLT 1.0 and 2.0 processors: MSXML3, MSXML4, MSXML6, .NET XslCompiledTransform, .NET XslTransform, Saxon 6.5.4, XML-SPY, Saxon 9.1.05, XQSharp, AltovaXML2011 (XML-SPY for XSLT 2.0).

    Note 2: If you really want to have the result wrapped int an <info> element, just add this template:

     <xsl:template match="info">
      <info>
       <xsl:text>&#xA;</xsl:text><xsl:apply-templates/><xsl:text>&#xA;</xsl:text>
      </info>
     </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to have a script automatically transform an xml file into several html
I have an XML file and I'm trying convert it into a (table( HTML
I have xml/rdf file which I get from service. So, I need to transform
I am trying to transform an xml file with xsl stylesheet into html. this
I use a xsl tranform to convert a xml file to html in dotNet.
I am trying to transform an XML file into an updated version. I have
My xsl file: <?xml version=1.0 encoding=UTF-8?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns:go=http://www.google.com exclude-result-prefixes=go> <xsl:include href=SomeLibrary.xsl/> <xsl:template
I've the following xslt file: <?xml version=1.0 encoding=UTF-8?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <!-- USDomesticCountryList -
I'm just getting started using XSL to transform XML to HTML and I'm hopping
I have an XML file that contains price value.I want to sort my table

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.