> that's where I can't quite make the leap, how to
> get from
>
> <Data>PartCode</Data>
>
> to specifying it as a variable name and then resolving it.
You wouldn't do that, variable refernces are compile time constructs
(just as they are in other languages such as C for example) so they
never depend on any run time information.
Your original post wasn't very clear what the input looked like.
You posted this:
<ChapterNameDefaults>
<Data>PartCode</Data>
<Text> </Text>
<Data>SectionNumber</Data>
<Text>.</Text>
<Data>ChapterNumber</Data>
</ChapterNameDefaults>
which I take it you want to be a template for the output but what is the
actual data like? I'll make a guess:
<Chapter>
<ChapterNumber>2</ChapterNumber>
<SectionNumber>3</SectionNumber>
<PartCode>1</PartCode>
<stuff>...</stuff>
</Chapter>
in which case
<xsl:template match="Chapter">
<xsl:variable name="ChapterName" >
<xsl:apply-templates select="/path/to/ChapterNameDefaults/*">
<xsl:with-param name="thischap" select"."/>
</xsl:apply-templates>
</xsl:variable>
..... <xsl:value-of select="$ChapterName"/>
</xsl:template>
<xsl:template match="ChapterNameDefaults/Data">
<xsl

aram name="thischap"/>
<xsl:value-of select="$thischap/*[name()=current()]"/>
</xsl:template>
David