Hello.
I need to create variables whose names are the value of the Position() function. I'm within a for-each loop and for each occurrence of an element I want to create a variable.
What I'm trying to accomplish is create some variables(one for each occurrence of <RCDATALINE>), set their values to the <TRC> value and have access to all these created variables.
So, with the following XML:
<RCDATALINE>
<TRC>90</TRC>
<OVERRIDE>Y</OVERRIDE>
</RCDATALINE>
<RCDATALINE>
<TRC>90</TRC>
<OVERRIDE>Y</OVERRIDE>
</RCDATALINE>
<RCDATALINE>
<TRC>90</TRC>
<OVERRIDE>N</OVERRIDE>
</RCDATALINE>
<RCDATALINE>
<TRC>90</TRC>
<OVERRIDE>N</OVERRIDE>
</RCDATALINE>
And the following XSLT code:
<xsl:for-each select="RCDATALINE">
<xsl:variable name=Position()>
<xsl:choose>
<xsl:when test=âTRC[.!=''] and OVERRIDE[.!='Y']â>
<xsl:value-of select=TRC>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=''>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
I now, within this for-each loop, want to check that the current <TRC> does not equal any of the values of these variables.
I have a post where I'm trying to accomplish not printing out previous same <TRC> values using "preceding-sibling" but am unable to get that to work under certain conditions. I'm now trying to use variables that have all <TRC> values stored in them (if <OVERRIDE> is not Y).
Here's the link to that post.
Code To Use the Position Function
I'm new to XSLT so don't know if I'm just wasting my time going this route!
Thanks,
Rita