Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 9th, 2010, 03:50 PM
Registered User
 
Join Date: Jan 2010
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default XML to HTML

How to make an HTML from XMl using XSLT?

Last edited by amadaeliseo; January 13th, 2010 at 01:16 PM..
 
Old January 9th, 2010, 06:59 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Just write template rules that match the parts of the input:

Code:
<xsl:template match="ss:Row[1]"/>

<xsl:template match="ss:Row/ss:Cell/ss:Data">
  <xsl:variable name="p" select="count(../preceding-sibling::ss:Cell)+1"/>
  <xsl:element name="{(../../preceding-sibling::ss:Row)[1]/ss:Cell[$p]/ss:Data}">
     <xsl:value-of select="."/>
  </xsl:element>
</xsl:template>
In your example, though, you'll have to convert "movie title" to a valid XML element name, perhaps by removing spaces using translate().
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
amadaeliseo (January 10th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
XML spreadsheet "comment" element in Excel. Benzion XSLT 3 December 3rd, 2008 12:29 PM
import excel xml Spreadsheet to dataset krissri_mtc XSLT 2 May 30th, 2007 07:21 AM
Excel Spreadsheet Help SteveV VBScript 0 October 10th, 2006 04:42 PM
Excel Spreadsheet Help SteveV BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 October 10th, 2006 04:41 PM
Excel Spreadsheet Help SteveV BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 October 10th, 2006 04:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.