Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help selecting nodes based on children

Status
Not open for further replies.

MicahD

Programmer
Nov 21, 2011
1
US
I would think this should be easy, but I am relatively new to XSL stylesheets, and I can't figure out what I am doing wrong. Essentially, I only want to include branches that have a specific end node. For instance, I only want the branches that have the tag <TargetID>Default</TargetID>. Given this input:

<?xml version="1.0" encoding="UTF-8"?>
<wc:COLLECTION>
<AddedECN NAME="AddedECN" TYPE="Unknown" STATUS="0">
<ECNHeader>
<Number>ECN0000146</Number>
<TargetID>Oracle 11i</TargetID>
<TargetID>Oracle 11i New</TargetID>
<TargetID>Oracle 11i New 10-26</TargetID>
</ECNHeader>
</AddedECN>
<ChangedECN NAME="ChangedECN" TYPE="Unknown" STATUS="0">
</ChangedECN>
<UnchangedECN NAME="UnchangedECN" TYPE="Unknown" STATUS="0">
<ECNHeader>
<Number>ECN0000146</Number>
<TargetID>Default</TargetID>
</ECNHeader>
</UnchangedECN>
</wc:COLLECTION>

I am looking for this output:

<wc:COLLECTION>
<UnchangedECN NAME="UnchangedECN" TYPE="Unknown" STATUS="0">
<ECNHeader>
<Number>ECN0000146</Number>
<TargetID>Default</TargetID>
</ECNHeader>
</UnchangedECN>
</wc:COLLECTION>

The actual XML file has many more entries, of course. But a start would really help me.

Thanks!
 
I can't figure out what I am doing wrong
It would be easier to determine this if we could see your actual stylesheet...

Tom Morrison
Micro Focus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top