Subject: Re: [xsl] #Please Help: Nested conditions|
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 20 Feb 2004 20:57:05 +0100
Can anyone please help me? O have the following problem I cannot solve:...
I am trying to transform a table structure which is, simplified, like this:
<TABLE> <TITLE>...</TITLE> <TROW> <TH> ... </TH> </TROW>
...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>
|<- Previous||Index||Next ->|
|RE: [xsl] #Please Help: Nested cond, G. Ken Holman||Thread||RE: [xsl] #Please Help: Nested cond, Matthias Fischer|
|Re: [xsl] HTML RANDOM NODE LIST, Wendell Piez||Date||RE: [xsl] HTML RANDOM NODE LIST, Josh Canfield|