Subject: [xsl] #Please Help: Nested conditions From: "Matthias Fischer" <it@xxxxxxxxxxxxxxxxxx> Date: Fri, 20 Feb 2004 20:13:51 +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> <TROW> <CELL> ... </CELL> </TROW> ... </TABLE> The availability and number of <TROW> elements with a nested <TH> or, respectively, with a nested <TB> varies. 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. The XSL approach I have worked out so far is this: <xsl:template match="TABLE"> <TABLE> <TTITLE> <xsl:value-of select="Table-TITLE"/> </TTITLE> <xsl:text disable-output-escaping="yes"> <TGROUP></xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes"> </TGROUP></xsl:text> </TABLE> </xsl:template> <xsl:template match="ROW"> <xsl:choose> <xsl:when test="element-available('TH')"> <THEAD> <xsl:apply-templates/> </THEAD> </xsl:when> <xsl:when test="element-available('CELL')"> <TBODY> <xsl:apply-templates/> </TBODY> </xsl:when> <xsl:when test="element-available('TH')"> <TFOOT> <xsl:apply-templates/> </TFOOT> </xsl:when> </xsl:choose> </xsl:template> <xsl:template match="TH | CELL | TF"> <TROW> <TDATA> <xsl:apply-templates/> </TDATA> </TROW> </xsl:template> However, this approach does not work. What am I doing wrong? Matthias Fischer XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL Transformation Questi, Wendell Piez | Thread | Re: [xsl] #Please Help: Nested cond, G. Ken Holman |
[xsl] XSL Transformation Question, Eric Fleming | Date | Re: [xsl] empty fo-block in table c, G. Ken Holman |
Month |