--edited for clarity (hopefully)
I have an XML file that looks something like this:
<questionBlock>
<responses>
. . .
<response>
<degree>1</degree>
<instdegree>1</instdegree>
</response>
. . .
</responses>
<question>
<variable>degree</variable>
<text>Please select a degree or credential you have pursued.</text>
<responses>
<response>
<label>High School Diploma</label>
<value>1</value>
</response>
<response>
<label>Certificate</label>
<value>2</value>
</response>
</responses>
. . .
</question>
</questionBlock>
A subset of the XSLT looks like this:
In addition to selecting the value of the degree (1), I also want to be able to select the "High School Diploma" based on that value, but I haven't been able to think through the XPath to do this in the general case (e.g., if degree equals 2). . . .
<xsl:for-each select="responses/response">
<xsl:variable name="paddedCount" select="concat('00',position())"/>
<xsl:variable name="s" select="substring($paddedCount,string-length($paddedCount)-1,string-length($paddedCount))"/>
<xsl:variable name="degree" select="degree" />
. . .
Any help would be much appreciated. Thanks.