Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old May 11th, 2009, 07:57 AM
Registered User
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT for displaying XML data in list order

Hi all,
i have the XML like this:
<MainHeading>TESTING XSLT</MainHeading>
<detail>This is name of user</detail>
<detail>This is address of user</detail>
<inner>Home </inner>

how can i write XSLT for this xml to that in the following manner

  • This is name of user
  • This is address of user
  • Home
  • Office
  • Personnel
Please show me the way, To get the solution whether
i have to change the xml or not.?
Reply With Quote
  #2 (permalink)  
Old May 11th, 2009, 08:27 AM
Friend of Wrox
Points: 6,612, Level: 34
Points: 6,612, Level: 34 Points: 6,612, Level: 34 Points: 6,612, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2007
Location: Germany
Posts: 1,234
Thanks: 0
Thanked 242 Times in 241 Posts

Assuming you want to transform your XML to HTML with heading (h1, h2) and list (ul, li) elements then here is a stylesheet:
  <xsl:output method="html" indent="yes"/>
  <xsl:strip-space elements="*"/>
  <xsl:template match="/Root">
  <xsl:template match="MainHeading">
  <xsl:template match="body">
      <xsl:apply-templates select="heading | detail"/>
  <xsl:template match="body/heading">
  <xsl:template match="body/detail">
  <xsl:template match="body/detail//text()">
      <xsl:value-of select="."/>

Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting fields, specific order from xml using xslt Jaipal XSLT 4 July 23rd, 2007 11:35 AM
how to populate a table with xml data in xslt miccipynewbie XSLT 6 May 28th, 2007 07:29 AM
How to Query XML Data from XSLT Form kwilliams XSLT 1 December 3rd, 2005 05:14 AM
using 2 sets of xml data from 1 xslt davepass XSLT 2 April 1st, 2005 05:31 PM
Displaying time in chronological order mg1966 Classic ASP Databases 3 January 24th, 2005 01:11 PM

All times are GMT -4. The time now is 06:22 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.