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

Re: Maybe newbie...

Subject: Re: Maybe newbie...
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 17 May 2002 15:03:23 +0100
Re:  Maybe newbie...
Hi Antonio,

> I think that using two nested for-each is quite dirty in my case, as
> a very similar effect could be achieved with a <xsl:for-each
> select="alarm/problemtype">.
>
> However, when using that one, position() is not 1, 2, 1, 2 but 1, 2,
> 3, 4, so the third line does not show the dates, where it should.
>
> I know I can substitute position by something else, but... what?

You could test whether the particular problemtype element has a
preceding sibling problemtype element; if it doesn't, then it's the
first within the particular alarm element:

  <xsl:for-each select="alarm/problemtype">
    <tr>
      <xsl:choose>
        <xsl:when test="preceding-sibling::problemtype">
          <td></td><td></td>
        </xsl:when>
        <xsl:otherwise>
          <td><xsl:value-of select="../@start" /></td>
          <td><xsl:value-of select="../@end" /></td>
        </xsl:otherwise>
      </xsl:choose>
      <td><xsl:value-of select="@qty" /></td>
      <td><xsl:value-of select="@type" /></td>
    </tr>
  </xsl:for-each>

It doesn't save you much though; might even make the transformation
marginally slower (it's easier to check the position of the current
node than it is to check the preceding sibling of the current node, I
think).
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.