View Single Post
  #6 (permalink)  
Old September 5th, 2006, 08:11 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>First of all: writing a statement like this <xsl:when test="{$p}=5"> where the variable value is being tested itself is erroring out.

You want test="$p=5". You never use curly brackets inside an XPath expression, only to separate an XPath expression from surrounding text in an Attribute Value Template.

> Also I wonder why there is no "else" part to the <xsl:if> element.

Because there is an xsl:choose instruction for that purpose

>Folloiwng-sibling, i guess works more w.r.t data already formatted in xml format and then we are trying to read. but in my case, the data i'm trying to read is in csv format from a text file, so in wonder if following-sibling would work or not.

following-sibling, like the other XPath axes, navigates within an XML tree. You can't use it unless (or until) you text is structured as a tree.

><xsl:when test="{$p}=5">
        <xsl:value-of select="following-sibling::{$value[4]}"/>

I'm afraid this isn't XSLT, I can't guess what you intend it to mean, so I can't tell you the correct code to write in its place.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote