XSLT: How to find a node containing TWO matching children?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bearclaws

    XSLT: How to find a node containing TWO matching children?

    I have the following XML:

    <AAA>
    <BBB>
    <CCC>111</CCC>
    <CCC>222</CCC>
    </BBB>
    <BBB>
    <CCC>333</CCC>
    <CCC>444</CCC>
    </BBB>
    </AAA>

    ....and want to loop through AAA to find all BBBs that contain CCC nodes
    matching 333 AND 444.

    Any thoughts on the most effecient syntax for this?

    Thanks,
    BC

  • Joris Gillis

    #2
    Re: XSLT: How to find a node containing TWO matching children?

    Tempore 18:40:18, die Thursday 10 March 2005 AD, hinc in foro {comp.text.xml} scripsit bearclaws <googlegroups@b encannon.com>:
    [color=blue]
    > ...and want to loop through AAA to find all BBBs that contain CCC nodes
    > matching 333 AND 444.
    >[/color]
    what about "AAA/BBB[CCC='333' and CCC='444']" ?


    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
    "Quot capita, tot sententiae" - Terentius , Phormio 454

    Comment

    • Martin Honnen

      #3
      Re: XSLT: How to find a node containing TWO matching children?



      bearclaws wrote:
      [color=blue]
      > I have the following XML:
      >
      > <AAA>
      > <BBB>
      > <CCC>111</CCC>
      > <CCC>222</CCC>
      > </BBB>
      > <BBB>
      > <CCC>333</CCC>
      > <CCC>444</CCC>
      > </BBB>
      > </AAA>
      >
      > ...and want to loop through AAA to find all BBBs that contain CCC nodes
      > matching 333 AND 444.[/color]

      If <AAA> is the root element there is not much to loop through, as for
      an XPath you would need
      /AAA/BBB[CCC = '333' and CCC = '444']

      --

      Martin Honnen

      Comment

      • bearclaws

        #4
        Re: XSLT: How to find a node containing TWO matching children?

        thanks! I was making my statement *much* more complicated than it
        needed to be!
        [color=blue][color=green]
        >>BC[/color][/color]

        Comment

        Working...