|
Subject: [xsl] match first occurrence for which a condition holds true From: "Robby Pelssers" <robby.pelssers@xxxxxxxxx> Date: Thu, 6 Jan 2011 15:22:42 +0100 |
Hi David,
I made a mistake in that match pattern by trying to simplify the xml source.
I'm using xslt2.0 (saxon).
Here is original xml before transformation:
<LeafExtName id="Cap">
<MaterialGroup id="Filler">
<MatClassDess matgchild="0" id="Glass Fibrous" extchild="0">
<MassPercent>30.35</MassPercent>
</MatClassDess>
</MaterialGroup>
<MaterialGroup id="Flame retardant">
<MatClassDess matgchild="0" id="Antimony trioxide (Sb2O3)" extchild="1">
<MassPercent>30.35</MassPercent>>
</MatClassDess>
</MaterialGroup>
<MaterialGroup id="Polymer">
<MatClassDess matgchild="0" id="Polybutylene terephthalate" extchild="2">
<MassPercent>20.50</MassPercent>
</MatClassDess>
</MaterialGroup>
<MaterialGroup id="Pigment">
<MatClassDess matgchild="0" id="Not disclosed by Subco." extchild="3">
<MassPercent>08.80</MassPercent>
</MatClassDess>
</MaterialGroup>
</LeafExtName>
In my current xslt I have following which i think is the same as you proposed
but that does not work. See outcome below.
<xsl:template
match="MassPercent[max(ancestor::LeafExtName/MaterialGroup/MatClassDess/MassP
ercent) = .][1]" mode="fixpercentages">
<MassPercent>TODO</MassPercent>
</xsl:template>
Result after transformation:
<LeafExtName id="Cap">
<MaterialGroup id="Filler">
<MatClassDess matgchild="0" id="Glass Fibrous" extchild="0">
<MassPercent>TODO</MassPercent>
</MatClassDess>
</MaterialGroup>
<MaterialGroup id="Flame retardant">
<MatClassDess matgchild="0" id="Antimony trioxide (Sb2O3)" extchild="1">
<MassPercent>TODO</MassPercent>>
</MatClassDess>
</MaterialGroup>
<MaterialGroup id="Polymer">
<MatClassDess matgchild="0" id="Polybutylene terephthalate" extchild="2">
<MassPercent>20.50</MassPercent>
</MatClassDess>
</MaterialGroup>
<MaterialGroup id="Pigment">
<MatClassDess matgchild="0" id="Not disclosed by Subco." extchild="3">
<MassPercent>08.80</MassPercent>
</MatClassDess>
</MaterialGroup>
</LeafExtName>
So adding [1] to the predicate does not work unfortunately.
Robby
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] match first occurrence fo, David Carlisle | Thread | Re: [xsl] match first occurrence fo, David Carlisle |
| Re: [xsl] match first occurrence fo, David Carlisle | Date | Re: [xsl] match first occurrence fo, David Carlisle |
| Month |