[xsl] AVT use and doc() function in xslt 2.0?

Subject: [xsl] AVT use and doc() function in xslt 2.0?
From: dvint@xxxxxxxxx
Date: Thu, 18 Aug 2011 12:19:11 -0700
I'm writing a stylesheet to process an xml file based upon data in a
second file. Actually I'm trying to map values in the source file being
processed against the lookup and then new values in the secondary file
being read with the doc() function.

So if I do this:

<xsl:copy-of
select="doc('dmcmapping.xml')/searchReplace/smodelic[@val='GAASIB0']"/>

I will find the info in the secondary file that I'm looking for.

If I do this, no result is returned:

<xsl:copy-of
select="doc('dmcmapping.xml')/searchReplace/smodelic[@val='{modelic}']"/>

where modelic is an elemnt I'm matching in the source document.

The complete template is:

<xsl:template match="dmc/avee">

<xsl:value-of select="normalize-space(modelic)"/>
<xsl:value-of select="normalize-space(sdc)"/>
<xsl:value-of select="normalize-space(chapnum)"/>
<xsl:value-of select="normalize-space(section)"/>
<xsl:value-of select="normalize-space(subsect)"/>
<xsl:value-of select="normalize-space(subject)"/>
<xsl:value-of select="normalize-space(discode)"/>
<xsl:value-of select="normalize-space(discodev)"/>
<xsl:value-of select="normalize-space(incode)"/>
<xsl:value-of select="normalize-space(incodev)"/>
<xsl:value-of select="normalize-space(itemloc)"/>

<xsl:copy-of
select="doc('dmcmapping.xml')/searchReplace/smodelic[@val='{modelic}']"/>

</xsl:template>

The value-of statements are printing the right values, so I know the
template is finding the data, but the handoff to the doc() function is not
working. I have tried assigning the value to a variable and that isn't
working either. I know the copy-of statement is working becasue I can copy
and paste the text returned into the select as shown above. I also checked
to make sure that there weren't any whitespace characters being added and
there aren't.

I have even gone as far as putting the value into a variable and then
referencing the variable:

<xsl:variable select="'GAASIB0'" name="modelic"/>
<xsl:copy-of
select="doc('dmcmapping.xml')/searchReplace/smodelic[@val='{$modelic}']"/>


What am I missing?

..dan

Current Thread