[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: #Please Help: Nested conditions

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

J.Pietschmann

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.