[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xsl:apply-templates behaving differently depending
On your XML (corrected for markup), the following XSL shoukld illustrate the
idea:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" /> <xsl:template match="node( ) | @*"> <xsl:copy> <xsl:apply-templates select="@* | node( )"/> </xsl:copy> </xsl:template> <xsl:template match="td[count(text()) = 0]"> <td> <xsl:text>__NOTHING__</xsl:text> <xsl:apply-templates/> </td> </xsl:template> </xsl:stylesheet> It uses an identity transform to copy everything verbatim, except for empty <td> elements, which are filled-in with default text. You should be able to use some variation of this for what you ultimately need. Of course, we were lucky here in that we could specifically match empty td elements. Things would not have been quite so easy otherwise. For example, XSL doesn't have a provision for invoking a template on a non-match--there was a thread about just that about 2 months ago. Regards, --A From: knocte <knocte@xxxxxxxxx> _________________________________________________________________ Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
|
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
|