RE: [xsl] Display order issue

Subject: RE: [xsl] Display order issue
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 13 Oct 2003 17:54:06 +0100

> -----Original Message-----
> From: Joseph Tan [mailto:Joseph.Tan@xxxxxxxxxxxxxxxxxx] 
> Sent: 13 October 2003 17:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx; mhk@xxxxxxxxx
> Subject: RE: [xsl] Display order issue
> 
> 
> GREAT!  This works.  I manage to get the display order I want 
> but I have problem getting the URL (B3) to link correctly.
> 
> Please take a  look at this and let me know what I did wrongly.
> 
> <xsl:variable name="url" select="../B3[number(current())]"/>
> <xsl:for-each select="B7">
>   <xsl:value-of select="../B2[number(current())]"/>
>   <xsl:text> (</xsl:text><a href="{$url}">Full-Text</a>     
>   <xsl:text>)</xsl:text>
>   <xsl:if test="position()!=last()">
> 	<xsl:text>, </xsl:text>
>    </xsl:if>	
> </xsl:for-each>
> 

Another case where I regret posting code. Do try to understand how it
works before you use it or extend it. If you don't understand it, please
ask for an explanation.

The xsl:for-each over the B7 elements sets the context node to each B7
element in turn, it then selects the B2 element whose position is equal
to the content of that B7 element. Why do you imagine that selecting a
B3 element outside this for-each is going to do anything useful?

Michael Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread