Re: #Please Help: Nested conditions
Can anyone please help me? O have the following problem I cannot solve:...
...The objective is to drop the <TH>'s and <TB>'s, and to wrap all <TROW>'s that before contained a <TH> into a single <THEAD> element, and similarly to wrap all <TROW>'s that before contained a <TB> into a single <TBODY> element.
<xsl:text disable-output-escaping="yes">Never ever use disable-output-escaping without reason.
> <xsl:when test="element-available('TH')"> You got something seriously wrong here too. The element-available() function is for dealing with extension elements in the style sheet.
> However, this approach does not work. What am I doing wrong? Well, I'd recommend to buy an XSLT book first and start reading it at the beginning.
In XSLT you select the elements you want to process in advance. The following will wrap the TROW elements containing TH elements in a THEAD and everything else in a TBODY. Unfortunately, your prose description is utterly inconsistent with the provided code, so I can't give more hints. <xsl:template match="table"> <xsl:copy> <xsl:copy-of select="TITLE"/> <xsl:if test="TROW[TH]"> <THEAD> <xsl:apply-templates select="TROW[TH]"/> </THEAD> </xsl:if> <xsl:if test="TROW[not(TH)]"> <TBODY> <xsl:apply-templates select="TROW[not(TH)]"/> </TBODY> </xsl:if> </xsl:copy> </xsl:template> <xsl:template match="node()|@*> <xsl:copy> <xsl:apply-templates select="node()|@*/> </xsl:copy> </xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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