Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Need to get previous node

From: "tshad" <toms@----.--->
To: 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 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent