xsl-list
[Top] [All Lists]

[xsl] Variable creation & use problem

2006-07-25 14:32:12
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[(_at_)ID=current()]/mets:mdWrap[(_at_)MDTYPE='MODS']">
                   <xsl:value-of 
select="$doc//mets:dmdSec[(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Variable creation & use problem, cielo rosso <=