You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Guoliang Cao <ca...@ispsoft.com> on 2000/11/22 15:52:30 UTC
Is parent::following-sibling correct?
Or parent::following-sibling::node()
or ../following-sibling
Which one is valid, and what's the difference?
Input is :
<A>
<B/>
<B/>
</A>
<A>
<B/>
<B/>
</A>
I want to generate n*(n-1)/2 code sections. n is the number of 'B'
My xsl looks like:
<xsl:for-each select="A">
<xsl:for-each select="B">
<xsl:for-each select="following-sibling">
<xsl:if test="contains(name(), 'B'">
......
</xsl:if>
</xsl:for-each select="parent::following-sibling"> <====== Doesn't
work!!!!
<xsl:for-each select="B">
......
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
Re: Is parent::following-sibling correct?
Posted by Gary L Peskin <ga...@firstech.com>.
Guoliang Cao wrote:
>
> I've tried a lot. This one works.
>
> "parent::node()/following-sibling::node()[name()='B']"
Glad you worked it out. Just to let you know that ".." is short for
parent::node() so you could also write:
"../following-sibling::node()[name()='B']"
or just
"../following-sibling::B"
HTH,
Gary
Re: Is parent::following-sibling correct?
Posted by Guoliang Cao <ca...@ispsoft.com>.
I've tried a lot. This one works.
"parent::node()/following-sibling::node()[name()='B']"
Guoliang Cao wrote:
> Or parent::following-sibling::node()
> or ../following-sibling
>
> Which one is valid, and what's the difference?
>
> Input is :
>
> <A>
> <B/>
> <B/>
> </A>
> <A>
> <B/>
> <B/>
> </A>
>
> I want to generate n*(n-1)/2 code sections. n is the number of 'B'
>
> My xsl looks like:
>
> <xsl:for-each select="A">
> <xsl:for-each select="B">
> <xsl:for-each select="following-sibling">
> <xsl:if test="contains(name(), 'B'">
> ......
> </xsl:if>
> </xsl:for-each select="parent::following-sibling"> <====== Doesn't
> work!!!!
> <xsl:for-each select="B">
> ......
> </xsl:for-each>
> </xsl:for-each>
> </xsl:for-each>