is there a way to define attributes based on other attributes from a node before? (excuse my terminology, i dont work often with xslt).
I got some soil layer data containing the end-depth of a layer. What is needed is the beginning-depth (the top) of an layer of an specific group.
My first attemps would be to give the first layer of an group the top = 0. The next layer gets a "DEPTHFROM" = DEPTHTO of the previous layer.
Maybe an example will clear up a bit:
A XML Datablock looking like that (some soil layer):
<ZONES>
<ZONE LAYER_DESC="Flysand unchained" DEPTHTO="0.30" GROUP="1"/>
<ZONE LAYER_DESC="Flysand unchained" DEPTHTO="1.10" GROUP="1"/>
<ZONE LAYER_DESC="Flysand unchained" DEPTHTO="1.40" GROUP="1"/>
<ZONE LAYER_DESC="Flysand unchained" DEPTHTO="1.70" GROUP="1"/>
<ZONE LAYER_DESC="Drifting sand" DEPTHTO="1.80" GROUP="1"/>
<ZONE LAYER_DESC="Drifting sand" DEPTHTO="2.20" GROUP="1"/>
<ZONE LAYER_DESC="Drifting sand" DEPTHTO="2.60" GROUP="1"/>
<ZONE LAYER_DESC="Sand unchained" DEPTHTO="0.30" GROUP="2"/>
<ZONE LAYER_DESC="Sand unchained" DEPTHTO="1.10" GROUP="2"/>
<ZONE LAYER_DESC="Sand unchained" DEPTHTO="1.40" GROUP="2"/>
<ZONE LAYER_DESC="Sand unchained" DEPTHTO="1.70" GROUP="2"/>
<ZONE LAYER_DESC="fine sand" DEPTHTO="1.80" GROUP="2"/>
<ZONE LAYER_DESC="fine sand" DEPTHTO="2.20" GROUP="2"/>
<ZONE LAYER_DESC="fine sand" DEPTHTO="2.60" GROUP="2"/>
</ZONES>
Using an xslt (stuck with xslt 1.0 engine) the desired output as a text could look like that:
(LAYER_DESC, 'DEPTHFROM'-> calculated from DEPTHTO from node above of specific layer group), quotes are not required
"Flysand unchained" "0.00"
"Flysand unchained" "0.30"
"Flysand unchained" "1.10"
"Flysand unchained" "1.40"
"Drifting sand" "1.70"
"Drifting sand" "1.80"
"Drifting sand" "2.20"
"Sand unchained" "0.00"
"Sand unchained" "0.30"
"Sand unchained" "1.10"
"Sand unchained" "1.40"
"fine sand" "1.80"
"fine sand" "2.20"
Im more used to database opeations and there I would probably use some row-counters for that task, that wouldnt be wild in there.
Kind regards and thanks for every idea, ill keep on searching.