C
C Wilson
I may need to resort to some other tool but right now I'm limiting
myself to XPath and XSLT and suchlike. I'm an XPath newbie.
I'm framing my question as a structural one and what I think I'm
looking for is a structural answer, not exact source code.
I have a document that has several collections at the same level. The
two that concern me are entities and numeric snapshots. That is, the
document contains a set of entities, each of which has, say, an ID
and a color. At the same level there is a collection of clumps of
numeric values, a snapshot of the state of the entity; each clump has
the ID of the entity of which it is a snapshot. Let's say weight and
ring size.
<blather>
<entities>
<entity id="x" color="magenta">
</entity>
</entities>
<snapshots>
<snapshot eid="x">
<weight>23</weight>
</snapshot>
</snapshots>
<blather>
I have worked up an XSLT that computes the grand total of all the
weights. I can do this looking only at the collection of snapshots.
Now I need to exclude some snapshots based on the color of their
associated entities. My goal is to calculate the grand total of all
weights for entities that (say) are not blue.
I'm open to such ideas as preprocessing the document to add the color
as an attribute of the snapshot, or whatever goes with the grain of
this XML world.
chw
myself to XPath and XSLT and suchlike. I'm an XPath newbie.
I'm framing my question as a structural one and what I think I'm
looking for is a structural answer, not exact source code.
I have a document that has several collections at the same level. The
two that concern me are entities and numeric snapshots. That is, the
document contains a set of entities, each of which has, say, an ID
and a color. At the same level there is a collection of clumps of
numeric values, a snapshot of the state of the entity; each clump has
the ID of the entity of which it is a snapshot. Let's say weight and
ring size.
<blather>
<entities>
<entity id="x" color="magenta">
</entity>
</entities>
<snapshots>
<snapshot eid="x">
<weight>23</weight>
</snapshot>
</snapshots>
<blather>
I have worked up an XSLT that computes the grand total of all the
weights. I can do this looking only at the collection of snapshots.
Now I need to exclude some snapshots based on the color of their
associated entities. My goal is to calculate the grand total of all
weights for entities that (say) are not blue.
I'm open to such ideas as preprocessing the document to add the color
as an attribute of the snapshot, or whatever goes with the grain of
this XML world.
chw