xsl-list
[Top] [All Lists]

Re: How to select immediate preceding-sibling value

2005-11-15 05:36:55
Thanks for the help

Regards,
Raj

--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:



              <xsl:for-each select="child::*">
you can just use select="*" child:: is implied.
                      <xsl:if test="name()='PanelName'">

better to use test="self::'PanelName" rather than
testing name()
                              <xsl:value-of

select="current()/preceding-sibling::Process/@name"/>

you never need to start with current() as relative
paths always start
from the current node. In this case you select the
name attributes of
all preceding siblings but value-of (in xslt1) gives
the string value of
just the first node in document order. If you just
want to select the
nearest sibling use
select="preceding-sibling::Process[1]/@name"

But there is no need to for-each over all nodes and
then have an xsl:if
test that just picks out the one you want, just
for-each over your
PanelName elements:

I think you just want

              <xsl:for-each select="PanelName">
                              <xsl:text>current node---       </xsl:text>
                              <xsl:value-of select="@name"/>
                              <xsl:text>Preceding sibling---</xsl:text>
                              <xsl:value-of
select="preceding-sibling::Process[1]/@name"/>
                              <xsl:text>
                              </xsl:text>
              </xsl:for-each>

David


________________________________________________________________________
This e-mail has been scanned for all viruses by
Star. The
service is powered by MessageLabs. For more
information on a proactive
anti-virus service working around the clock, around
the globe, visit:
http://www.star.net.uk

________________________________________________________________________


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>