Re: [xsl] #Please Help: Nested conditions

Subject: Re: [xsl] #Please Help: Nested conditions
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 20 Feb 2004 20:57:05 +0100
Matthias Fischer wrote:
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

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
  <xsl:template match="table">
       <xsl:copy-of select="TITLE"/>
       <xsl:if test="TROW[TH]">
            <xsl:apply-templates select="TROW[TH]"/>
       <xsl:if test="TROW[not(TH)]">
            <xsl:apply-templates select="TROW[not(TH)]"/>
  <xsl:template match="node()|@*>
      <xsl:apply-templates select="node()|@*/>


XSL-List info and archive:

Current Thread