xsl-list
[Top] [All Lists]

RE: Getting specific elements from a list

2005-05-26 14:35:01
I think Dimitre's solution is the better choice, as it avoids the overhead 
of a variable and the extra processing of the // operator. So if you ever 
want to optimize, look at Dimitre's suggestions again.

Still, I'm glad we could help you make something that works.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




"Simon, Jb" <jb(_dot_)simon(_at_)lmco(_dot_)com> 
05/26/2005 04:24 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com


To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc

Subject
RE: [xsl] Getting specific elements from a list






-----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>
--~--




--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>