This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: sibling axis: can't restrict
- To: xsl-list at mulberrytech dot com
- Subject: RE: sibling axis: can't restrict
- From: "Meltsner, Kenneth" <Kenneth dot Meltsner at ca dot com>
- Date: Fri, 6 Oct 2000 13:31:29 -0400
- Reply-To: xsl-list at mulberrytech dot com
The test finds the first ead element on the following-sibling axis.
I'm sure there's a better way to do this, but might something like
test="following-sibling::ead[position()=1 and
preceding-sibling::*[1]=current()]"
work?
Ken Meltsner
-----Original Message-----
From: Pollington, Lee (ELSLON) [mailto:lee.pollington@biomednet.com]
Sent: Friday, October 06, 2000 8:45 AM
To: 'xsl-list@mulberrytech.com'
Subject: sibling axis: can't restrict
I saw a previous sibling axis question, but am still stumped on this. The
debug output suggests that the axis restriction [1] is right and I should
only link the name with the email address if the first following sibling
element is "ead", but both names are getting linked as if the test was
acting upon all following siblings.
tia
Lee
XSLT:
<xsl:for-each select="au">
<xsl:choose>
<xsl:when test="following-sibling::ead[1]">
<a>
<xsl:attribute name="href">
<xsl:text>mailto:</xsl:text>
<xsl:value-of
select="following-sibling::ead[1]"/>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
</xsl:choose>
[next: <xsl:value-of select="following-sibling::node()"/>]
<xsl:choose>
<xsl:when test="position()=last()-1"> and </xsl:when>
<xsl:when test="position()=last()"><xsl:text>
</xsl:text></xsl:when>
<xsl:otherwise>, </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
OUTPUT: Note: both names are linked with the single email address
by Saul A. Datwyler [next: Claude F.Meares] and Claude F. Meares [next:
cfmeares@ucdavis.edu]
XML:
<au>
<fnm>
<fnm-data>Saul A.</fnm-data>
</fnm>
<snm>
<snm-data>Datwyler</snm-data>
</snm>
</au>
<au>
<fnm>
<fnm-data>Claude F.</fnm-data>
</fnm>
<snm>
<snm-data>Meares</snm-data>
</snm>
</au>
<ead type="email">cfmeares@ucdavis.edu</ead>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list