Child Nodes Selection

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

    #1

    Child Nodes Selection

    Hi all,

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

    <user>
    <first_name>Geo rge</first_name>
    <sur_name>Georg e</sur_name>
    <dob>George</dob>
    <title>Line Manager</title>
    </user>

    I would like to obtain a node-set that gives me...
    <user>
    <first_name>Geo rge</first_name>
    <sur_name>Georg e</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
  • Richard Tobin

    #2
    Re: Child Nodes Selection

    In article <971bc529.04100 80743.6792128d@ posting.google. com>,
    Bryan Galvin <bryan_galvin@h otmail.com> wrote:
    [color=blue]
    >Is it possible to 'cherry-pick' child nodes but retain their
    >parentage.[/color]

    No.
    [color=blue]
    >I am trying to achieve this is a single XPATH expression[/color]

    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

    Comment

    • Bryan Galvin

      #3
      Re: Child Nodes Selection

      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@cogsci. ed.ac.uk (Richard Tobin) wrote in message news:<ck70ph$1j r5$1@pc-news.cogsci.ed. ac.uk>...[color=blue]
      > In article <971bc529.04100 80743.6792128d@ posting.google. com>,
      > Bryan Galvin <bryan_galvin@h otmail.com> wrote:
      >[color=green]
      > >Is it possible to 'cherry-pick' child nodes but retain their
      > >parentage.[/color]
      >
      > No.
      >[color=green]
      > >I am trying to achieve this is a single XPATH expression[/color]
      >
      > 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[/color]

      Comment

      Working...