[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Extracting text between nodes
Hi,
<td><font><b>Title</b><br/>Some Text<i> and some more italic text</i><b> maybe even some more</b><a href="http://whatever.com">And an anchor</a></font></td> A variant of several solutions suggested so far: <xsl:template match="td"> <xsl:apply-templates select="font/br[1]/following-sibling::node()"/> </xsl:template> <xsl:template match="td/font/a[not(following-sibling::node()]" priority="1002"/> <xsl:template match="td/font/*" priority="1001"> <xsl:apply-templates/> </xsl:template> I agree with Mike that a clearer statement of the problem is in order. "Extracting the text" might mean what it says (as Mike has construed it) or it might mean what David and Sam have inferred, which given everything we know about common XSLT use cases, and the roughness of the specification, is perhaps equally likely or more so. There are questions (as all have suggested) regarding how general the solution needs to be. For example, it is common to have to processing the intervening nodes (the italics and such), not just get their text values. (In which case, the last template given here can simply be dropped.) Cheers, Wendell At 04:45 AM 2/14/2008, Mike wrote:
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|