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

Re: Select previous sibling where attribute is not emp

Subject: Re: Select previous sibling where attribute is not empty
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 13 Apr 2010 16:17:19 +0100
Re:  Select previous sibling where attribute is not emp
On 13/04/2010 16:03, Mathieu Malaterre wrote:
Hi there,

   I am trying to select preceding-sibling::row[1] or
preceding-sibling::row[2] in the following example. Of course '1' or
'2' are hardcoded, and instead I need to express instead " where
entry/@morerows != '' "

Here is my Input.xml:

    <informaltable frame="all">
       <tgroup cols="3.782608695652174"><tbody><row>
             <entry morerows="2">
                <para>General Study</para>
                <para>Patient Study</para>
                <para>Clinical Trial Study</para>

My current xsl script is:

   <xsl:template match="row">
     <xsl:if test="count(entry) = 3">
       <xsl:value-of select="preceding-sibling::row[entry/@morerows != '' ]"/>

Thanks for suggestions,

entry/@morerows != ''

as a general rule never use != if either operand is a sequence (or a simpler rule, never use != at all) There are times when you want to break this rule but they are rather infrequent. The semantics of not(entry/@morerows = '') are far simpler (and far more frequently desired) than those of entry/@morerows != ''

I'm not at all clear what your requirement is, if you want the nearest
row that doesn't have an entry with a morerows attribute then that would be



________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

Current Thread


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.
First Name
Last Name
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.