XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 19th, 2004, 10:31 AM
lamwh lamwh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 lamwh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How can XSL transform XHTML data into fragments?

Hi,

I wonder if anyone know how to use XSL to transform an XHTML file that contains certain blocks of text within the <td> tags, for example:

<td valign="TOP" align="LEFT" bgcolor="#FFFFFF" width="260" class="WhiteBackBlackText">Is London the best place?</td>
where I try to extract "Is London the best place?" to a data section named "<tag>", so that the result will be:

<tag>Is London the best place?</tag>

I know you can do certain apply-templates functions, but just do not know how I can get the data from an XHTML extract such as a piece of table data within a table.

The following code will get me back all the text of all the table data fragments that exists to put into the <tag></tag> section.

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

<xsl:template match="/">
<root>
<xsl:apply-templates select="table/tr"/>
</root>
</xsl:template>

<xsl:template match="td">
<tag><xsl:value-of select="." /></tag>
</xsl:template>
</xsl:stylesheet>


Am I on the right lines?

Last edited by lamwh : April 26th, 2004 at 04:17 AM. Reason: Changed title and make content more precise.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSL to transform XHTML data into fragments


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT