RE: [xsl] following-sibling problem

Subject: RE: [xsl] following-sibling problem
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Thu, 7 Jun 2007 12:33:36 +0530
The problem is in 
<xsl:when  test="following-sibling::ReferenceReasonText[1]">
This is equivalent to testing if there is a  ReferenceReasonText after the
current node.
What you need is to test if the next immediate node is a ReferenceReasonText
So you need 

-----Original Message-----
From: Andy Carr1 [mailto:CARRA@xxxxxxxxxx] 
Sent: Wednesday, June 06, 2007 5:44 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] following-sibling problem

I have some source xml that looks like this:

        <Reference>Something Else</Reference>
        <ReferenceReasonText>Reason for Something 
        <Reference>Another reference</Reference>

I'm applying a template match on References

<xsl:apply-templates select="References" />


<xsl:template match="References/Reference">

        <!-- I've set up a test variable to determine if the 
following-sibling is a <ReferenceReasonText> -->
        <xsl:variable name="test">


The value of the test variable returns the following after transformation:

        <Reference>Something</Reference>        VARIABLE = TRUE
        <Reference>Something Else</Reference> VARIABLE = TRUE
        <ReferenceReasonText>Reason for Something 
        <Reference>Another reference</Reference>        VARIABLE = FALSE

For the first instance of Reference I would expect the variable to be 
False, what am I doing wrong ... anyone?

I've used following-sibling::xxxxx[1] before and got the results I 
expected. The only difference that I can see is that this XSLT (v2.0) is 
wrapped up in some FO using XEP 4.3 to produce PDF.


Andy Carr
Senior IT Specialist
Tel: Internal - 298037 External - 01252 558037
Mail Point  M1C IBM Application Services
Meudon House, Meudon Avenue, Farnborough, GU14 7NB
(Notes) Andy Carr1/UK/IBM@IBMGB 

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Current Thread