[xsl] Variable creation & use problem

Subject: [xsl] Variable creation & use problem
From: "cielo rosso" <cielorosso@xxxxxxxxx>
Date: Tue, 25 Jul 2006 14:30:49 -0700
Hi,

I'm having problems creating a variable which I use as a parameter in
a template call.

What I'm trying to do: I want to parse a string containing ID's and
create a variable which contains the node that satisfy a given
condition whose ID is among those in the string. I want to pass this
variable as a parameter to a template call.

This is what I have:
[....] NOTE1: tokenize($list[1]/@DMDID returns something like "DMD1 DMRD1"
      NOTE2: There is only one node that satisfy the condition,
either the one with ID=DMD1 or ID=DMRD1,
                    I want to find which one and store it into a variable.

      <xsl:variable name="dmdnode">
           <!-- Find the mods nodes with the DM id's-->
           <xsl:for-each select="tokenize($list[1]/@DMDID, ' ')">
               <xsl:if
test="$doc//mets:dmdSec[@ID=current()]/mets:mdWrap[@MDTYPE='MODS']">
                   <xsl:value-of select="$doc//mets:dmdSec[@ID=current()]"/>
               </xsl:if>
           </xsl:for-each>
       </xsl:variable>
 [.....]
                   <xsl:call-template name="addAttributesAndFields">
                       <xsl:with-param name="doc" select="$doc"/>
                       <xsl:with-param name="type" select="$type"/>
                       <xsl:with-param name="dmdnode" select="$dmdnode"/>
                   </xsl:call-template>

If I just write out what the for-each creates, I get the correct
values, however, when I try to use the dmdnode variable, I get a node
containing an empty document fragment.

Thanks for your insight,

Giulia

Current Thread