Child Nodes Selection

Discussion in 'XML' started by Bryan Galvin, Oct 8, 2004.

  1. Bryan Galvin

    Bryan Galvin Guest

    Hi all,

    Is it possible to 'cherry-pick' child nodes but retain their
    parentage. Given an example...

    <user>
    <first_name>George</first_name>
    <sur_name>George</sur_name>
    <dob>George</dob>
    <title>Line Manager</title>
    </user>

    I would like to obtain a node-set that gives me...
    <user>
    <first_name>George</first_name>
    <sur_name>George</sur_name>
    </user>

    I am trying to achieve this is a single XPATH expression, creating a
    variable to hold my new smaller node-set. I am trying to make my
    stylesheets less memory intensive by only focusing on those elements I
    am interested. Effectively working with smaller records.

    Any assistance is very appreciated,

    Bryan Galvin
    Bryan Galvin, Oct 8, 2004
    #1
    1. Advertising

  2. In article <>,
    Bryan Galvin <> wrote:

    >Is it possible to 'cherry-pick' child nodes but retain their
    >parentage.


    No.

    >I am trying to achieve this is a single XPATH expression


    XPath is a way of identifying (by "paths") nodes in a document. It
    can never return a node that is not in the input. You need to create
    a new element with the children you want, or modify an existing node,
    and XPath cannot do either of these things.

    -- Richard
    Richard Tobin, Oct 8, 2004
    #2
    1. Advertising

  3. Bryan Galvin

    Bryan Galvin Guest

    Richard,

    As I suspected. From all my experience of XPATH and XSLT I could not
    see how it was feasable. I have embarked on an alternative path where
    the nodes I require are prepared several stages before hand into a
    <compound_key> element.

    Regards,

    Bryan Galvin


    (Richard Tobin) wrote in message news:<ck70ph$1jr5$>...
    > In article <>,
    > Bryan Galvin <> wrote:
    >
    > >Is it possible to 'cherry-pick' child nodes but retain their
    > >parentage.

    >
    > No.
    >
    > >I am trying to achieve this is a single XPATH expression

    >
    > XPath is a way of identifying (by "paths") nodes in a document. It
    > can never return a node that is not in the input. You need to create
    > a new element with the children you want, or modify an existing node,
    > and XPath cannot do either of these things.
    >
    > -- Richard
    Bryan Galvin, Oct 12, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. asd
    Replies:
    3
    Views:
    429
    Arnaud Berger
    May 23, 2005
  2. gavnosis
    Replies:
    0
    Views:
    500
    gavnosis
    Aug 2, 2003
  3. Jeff Rodriguez
    Replies:
    23
    Views:
    1,091
    David Schwartz
    Dec 9, 2003
  4. Replies:
    1
    Views:
    558
    Soren Kuula
    Aug 24, 2006
  5. Replies:
    1
    Views:
    1,195
    Joe Kesselman
    Nov 1, 2006
Loading...

Share This Page