Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Need to get previous node Need to get previous nodeTo: NULL Date: 8/4/2009 4:53:00 PM
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:choose>
<xsl:when test=". != ''">
<attachment>
<source>
<xsl:value-of select="../PHOTO/@NUM"/>
</source>
</attachment>
</xsl:when>
</xsl:choose>
</xsl:template>
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.
But this gets me '1' for all three PHOTOs.
I want to get '1' for the first PHOTO, '2' for the 2nd PHOTO and '3' for the
3rd PHOTO.
It seems to always get the first one instead of the immediately preceding
one.
Thanks,
Tom
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
