ok, a quick update :
this is the code from my stylesheet so far :
<dommapper:inc name="segment_count"/>
<xsl:variable name="SRT1"><xsl:value-of select="../SRT1"/></xsl:variable>
<xsl:variable name="SRT3"><xsl:value-of select="../SRT3"/></xsl:variable>
<xsl:variable name="P_SRT1"><xsl:value-of select="../../SRT/SRT1"/></xsl:variable>
<xsl:variable name="P_SRT3"><xsl:value-of select="../../SRT/SRT3"/></xsl:variable>
<xsl:variable name="v4451"><xsl:value-of select="../../SRT[($P_SRT1=$SRT1) and ($P_SRT3=$SRT3)]/FTX2[FTX4451 = 'AAA']/FTX4451"/></xsl:variable>
I'll explain a bit. I have the following node structure (or input xml, whatever you want to call it) :
<SRT>
<ElementsSRT>
<SRT1>
<SRT2>
<SRT3>
</ElementsSRT>
<GID>
</GID>
<FTX2>
</FTX2>
</SRT>
Now what I need to accomplish is the following. Sometimes the SRT doesnt have a FTX child. If this happens, I need to go back to the previous SRT with the correct qualifier and fill the current FTX up with data from that FTX. The qualifiers are in the SRT1 and SRT3 fields. Thus I get the construction : <xsl:variable name="v4451"><xsl:value-of select="../../SRT[($P_SRT1=$SRT1) and ($P_SRT3=$SRT3)]/FTX2[FTX4451 = 'AAA']/FTX4451"/></xsl:variable>. The only problem I now face is that when I use this construction, he goes up one level, but he keeps going to the VERY FIRST SRT node and not the previous as is demanded.
Imagine a row of 5 items. I'm inside the 3rd item, but I lack information, so I check to see if the item before me, the second item (via SRT1 and SRT3, which I compare to my SRT1 and SRT3 from the item I'm in, the 3rd) has the information required. The preceding item will always have the required information! Instead my test now goes back to the first item, checks and even when the check is false, gives me the information from that item. I'm very close to solving it, but I can't grasp that final thingy :-) I hope this explains it better?
The output needs to be:
<GID>
...some tags
<FTX2></FTX2>
...some tags
</GID>
The output is not the issue here, it is getting the right information to create the output.
|