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 April 19th, 2004, 10:15 AM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can XSL transform XHTML data into fragments?

Hi,

I wonder if anyone know how 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?

I will be very grateful for any suggestions :)!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
html tags to reformed to xhtml standard using xsl swapbpl XSLT 12 May 8th, 2008 05:38 AM
How do you transform a XML SOAP Response using XSL wsessoms VB How-To 0 December 20th, 2006 08:21 AM
xHTML to XSL:FO to PDF NotesSensei XSLT 0 September 2nd, 2006 10:02 AM
Transform an XSL sheet khanman225 XSLT 8 July 6th, 2006 10:21 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





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