xsl-list
[Top] [All Lists]

RE: Getting specific elements from a list

2005-05-26 14:24:39
-----Original Message-----
From: Dimitre Novatchev [mailto:dnovatchev(_at_)gmail(_dot_)com] 
Sent: Thursday, May 26, 2005 5:08 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Getting specific elements from a list> 

The correct XPath expressions to use are, therefore:

Snip 


   (.//EnumValueDescription)[1]

and

   (.//EnumValueDescription)[last()]



Of course, in this particular case it is best *not* to use the "//"
abbreviation. What would suffice is just:

   tblEnumValues/EnumValueDescription[1]

and

   tblEnumValues/EnumValueDescription[last()]




-----Original Message-----
From: JBryant(_at_)s-s-t(_dot_)com [mailto:JBryant(_at_)s-s-t(_dot_)com] 
Sent: Thursday, May 26, 2005 5:09 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Getting specific elements from a list


Snip

  <xsl:variable name="EVDs" select="//EnumValueDescription"/>

  <xsl:template match="tblEnumeratedTypes">
    test (
          int,
          <xsl:value-of select="EnumeratedType"/>,
          <xsl:value-of select="$EVDs[1]"/>,
          <xsl:value-of select="$EVDs[last()]"/>
    );
  </xsl:template>

Thanks to all ...

I ended up using Jay Bryant's Solution, I could not get Dimitres'
solution to work, 
Kept getting blanks, although I now understand what was going on and it
looks like his solution should also work.

I just had to change Jay's solution from 

  <xsl:variable name="EVDs" select="//EnumValueDescription"/>

To 

<xsl:variable name="EVDs" select=".//EnumValueDescription"/>

Thanks to All !

Joe Simon
Lockheed Martin, Systems Integration, Owego, NY

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--