[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: sibling axis: can't restrict

Subject: RE: sibling axis: can't restrict
From: sara.mitchell@xxxxxxxxx
Date: Fri, 6 Oct 2000 12:28:31 -0400
xsl axis sibling
Well if I understand what you want, you're test is not correct:

<xsl:when test="following-sibling::ead[1]">

actually means "If the au node has at least 1 following-sibling
named ead -- it's not finding the first sibling node, but the first
ead sibling node. What you want is something more like this (untested):

<xsl:when test="following-sibling::*[1][name()='ead']">

This means find the first following sibling and test the name, if 
it's ead, then continue. 

Sara

> -----Original Message-----
> From: Pollington, Lee (ELSLON) [mailto:lee.pollington@xxxxxxxxxxxxx]
> Sent: Friday, October 06, 2000 6:45 AM
> To: 'xsl-list@xxxxxxxxxxxxxxxx'
> 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@xxxxxxxxxxx] 
> 
> 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@xxxxxxxxxxx</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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.