View Single Post
  #1 (permalink)  
Old January 19th, 2005, 01:11 PM
EstherMStrom EstherMStrom is offline
Authorized User
Join Date: Sep 2004
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing a variable into the id() function

<xsl:variable name="navDivID">
<xsl:value-of select="ancestor::NavigationDivision[1]/@PEDivRef" />

<xsl:value-of select="$navDivID" />

This works so far - it pulls in the correct PEDivRef. Now I need to find the corresponding ID. If I hard-code the ID (value returned by navDivID) into a select with id(), like so:

<xsl:value-of select="id('c3')/PETOCEntry/Title" />

I get nothing. So, two questions: first, is the above syntax correct for pulling in the following (I should get Feelin' Fine):

<PEDiv id="c3">
<PETOCEntry id="c3a">
<Title CrossAlign="No">Feelin' Fine!</Title>

And second, how do I pass the variable $navDivID into the id function? I've tried this:

<xsl:value-of select="id('{$navDivID}')/PETOCEntry/Title" />

but I get an error: "This name may not contain the '{' character:-->{<--$navDivID}"

I've tried
<xsl:value-of select="id('$navDivID')/PETOCEntry/Title" />

and get "This name may not contain the '$' character: -->$<--navDivID"

I've tried
<xsl:value-of select="id({navDivID})/PETOCEntry/Title" />

and get "Expression expected. id(-->{<--navDivID})/PETOCEntry/Title"

Reply With Quote