You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Cory Isaacson <ci...@compuflex.com> on 2002/10/30 04:26:46 UTC

XPath Question

If I have a document like this:

<a>
  <b>value1</b>
  <b>value2</b>
  <b>value3</b>
</a>

And I want to find the '<a>' node which has the 2nd '<b>' = value2 and the
3rd '<b>' = value3, is there any way to do this? I have tried position, such
as (from the context of <a>):

<xsl:value-of select="./*[(position()=2 and .='value2') and (position()=3)
and .='value3'" />

It seems that its checking one node at a time, so the node cannot belong to
position 2 and 3 at the same time. Any ideas?

Thanks,

Cory

Cory Isaacson
President & CTO
Compuflex International
(818) 884-1168
cisaacson@compuflex.com
www.compuflex.com


RE: XPath Question

Posted by Cory Isaacson <ci...@compuflex.com>.
Never mind, I solved it.

Cory
  -----Original Message-----
  From: Cory Isaacson [mailto:cisaacson@compuflex.com]
  Sent: Tuesday, October 29, 2002 7:27 PM
  To: xalan-dev@xml. apache. org
  Subject: XPath Question


  If I have a document like this:

  <a>
    <b>value1</b>
    <b>value2</b>
    <b>value3</b>
  </a>

  And I want to find the '<a>' node which has the 2nd '<b>' = value2 and the
3rd '<b>' = value3, is there any way to do this? I have tried position, such
as (from the context of <a>):

  <xsl:value-of select="./*[(position()=2 and .='value2') and (position()=3)
and .='value3'" />

  It seems that its checking one node at a time, so the node cannot belong
to position 2 and 3 at the same time. Any ideas?

  Thanks,

  Cory

  Cory Isaacson
  President & CTO
  Compuflex International
  (818) 884-1168
  cisaacson@compuflex.com
  www.compuflex.com