This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Testing position of parent
- To: XSL-List at mulberrytech dot com
- Subject: Testing position of parent
- From: Paul Caton <paul at mama dot stg dot brown dot edu>
- Date: Wed, 25 Oct 2000 11:27:51 -0400 (EDT)
- Reply-To: xsl-list at mulberrytech dot com
Apologies for posting what will probably turn out to be a trivial
problem, but I'm having a serious brain-block in spotting my mistake
here. I want my template for <l> elements to impose the following test
condition:
if the parent is an <LG> which has first position among its
siblings, then do X, otherwise do Y
Here's what I thought would be the expression to accomplish that:
<xsl:when test="parent::lg[position()=1]">
However, when I apply the template to something like this:
<q>
<lg type="quatrain">
<l>I eat my peas with honey,</l>
<l>I've done it all my life;</l>
<l>It makes the peas taste funny</l>
<l>but it keeps them on the knife.</l>
</lg>
<lg type="quatrain">
<l>The boy stood on the burning deck,</l>
<l>Eating peanuts by the peck;</l>
<l>His mother said he would not go</l>
<l>Because he loved those peanuts so.</l>
</lg>
</q>
X gets done to every <l>, even the ones in the second <lg> that were
supposed to be excluded by the test. Can someone please slap me upside
the head and point out what I'm doing wrong?
Paul.
--
Paul Caton
Electronic Publications Editor
Women Writers Project
e-mail: paul@mail.stg.brown.edu
tel: (401) 863-3619
address: Box 1841, Brown University, Providence RI 02912
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list