This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Next Node
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Next Node
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Thu, 14 Jun 2001 15:54:51 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> I have this XML
> <PAGE>
> <partner name="Oops" image="3810.bin" url="www.oops.com">
> <text>
> <line>development tool</line>
> <line>Integrated Development Environment.</line>
> </text>
> </partner>
> </PAGE>
>
> Of course, this has a lot of partner elements.
> I´m using this XSL
I can't begin to understand this!
>
> <xsl:for-each select="//PAGE/partner">
Is PAGE the outermost element of your XML? Then write /PAGE, otherwise the
system has to search for all the PAGE elements anywhere in the document.
> <xsl:variable name="contador">
> <xsl:value-of select="count (//PAGE/partner)"/>
> </xsl:variable>
Do you really want to create a result tree fragment containing a single text
node, or do you want the integer value:
<xsl:variable name="contador" select="count(//PAGE/partner)"/>
And if that's what you want, you can get it far more efficiently as
<xsl:variable name="contador" select="last()"/>
> <xsl:if test="contador div //PAGE/partner[position()] = 1">
Are you trying to test against the variable? In that case you want
$contador.
The predicate [position()] means [position()=position()] and is always true.
I've no idea what you thought it meant.
>
src="{@image}.bwpf?bwpsid={//bwp_page/@bwpsid}&bwpsky={//bwp_page/@bwpsk
y}"
Where does //bwp_page come from? It's not in your source!
>
> As you see, I´m calling the same element in the same
> for-each, but I want
> to call "the next" element in the second if statement.
I'm afraid I don't see anything of the kind...
Mike Kay
Software AG
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list