Child Nodes Selection

B

Bryan Galvin

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
 
R

Richard Tobin

Bryan Galvin said:
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
 
B

Bryan Galvin

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top