Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Need to get previous node >Thread Next - Re: Need to get previous node Re: Need to get previous nodeTo: NULL Date: 8/5/2009 9:28:00 AM
"Martin Honnen" <mahotrash@y...> wrote in message
news:%23AP5tGbFKHA.3816@T......
> tshad wrote:
>> Here is part of my xml:
>>
>> <FORMPHOTOS>
>> <PHOTO NUM="1">
>> <FILENAME>09May001.jpg</FILENAME>
>> <FILETYPE>JPEG</FILETYPE>
>> </PHOTO>
>> <PHOTO NUM="2">
>> <FILENAME>09005.jpg</FILENAME>
>> <FILETYPE>JPEG</FILETYPE>
>> </PHOTO>
>> <PHOTO NUM="3">
>> <FILENAME>09002.jpg</FILENAME>
>> <FILETYPE>JPEG</FILETYPE>
>> </PHOTO>
>> </FORMPHOTOS>
>>
>> In my xsl sheet I am doing:
>>
>> <xsl:template match="FORMPHOTOS/PHOTO">
>
>> <xsl:value-of select="../PHOTO/@NUM"/>
>
>
>> In my source tag I am actually doing a little more but I am trying to get
>> the value of @NUM from the immediately preceding node.
>
> <xsl:value-of select="preceding-sibling::PHOTO[1]/@NUM"/>
Almost worked, but not quite.
It seems to go back 2.
The results I got for my xml were:
09May001.jpg -> blank
09005.jpg -> 1
09002.jpg -> 2
I got the same result if I did:
<xsl:value-of select="preceding::PHOTO[1]/@NUM"/>
Not sure what the difference is.
If I changed [1] to [0], I get blank for all three. I thought maybe it was
zero based.
Thanks,
Tom
>
> --
>
> Martin Honnen --- MVP XML
> http://msmvps.com/blogs/martin_honnen/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
