xsl-list
[Top] [All Lists]

Returning an element's position number

2006-02-16 08:07:15
Hi-

I am trying to create what we are calling a "table legend" which is similar to 
a footnote in a table. At the beginning of the table content model, we allow 
for any number of legends to be defined - this is the content for each of the 
"footnotes". Each legend has an ID value on it. I access these and print them 
at the end of my table and number them sequentially - that all works fine.

Next within the table cells, we allow a reference to these legends called 
"legendRef" which is an empty tag but has a link attribute on it (in the 
example belowI massage it into a variable called $matchLink). The link 
attribute will contain a reference to an ID on one of the legends that were 
previously defined. Now what I need to do is match up the legendRef with the 
correct legend it should refer to and where the tag is, I need to print the 
appropriate number from the list of legends as my footnote symbol so that the 
numbers match up. I am having trouble determining the legend number that I am 
pointing to from here.

In my template for legendRef, when I do the following:
<xsl:value-of select="ancestor::table/legend/@id=$matchLink"/>
I am getting "true" to output as my footnote symbol in the table cell. I 
understand why because it matches but that's not what I want. I kept trying to 
put a position() after it to get the number of the legend, but I was getting an 
error when I did that.

Next I tried:
<xsl:number value="ancestor::table/legend/@id=$matchLink"/>
Which returns "1" all of the time in my footnote symbol. That's not what I want 
either.

I keep looking at and trying things like count() and position() thinking that's 
what I want but I can't seem to make this work the way I am hoping for. For 
example, if I have the following legends:

<legend id="abc">The first legend goes here.</legend>
<legend id="def">The second legend goes here.</legend>
<legend id="xyz">The third legend goes here.</legend>

And in my table cell, I have:
<paraTable>I think I will reference the third legend<legendRef 
link="xyz"/>.</paraTable>

In my output, I would like to see:
I think I will reference the third legend3.  <---imagine that the 3 was 
superscripted.

Does anyone have any suggestions how I can get the number "3"??? I know this is 
probably going to end up being something simple but I feel I keep trying to 
make this more complicated than it needs to be!

Thanks for any help,
Cindy Hunt




--~------------------------------------------------------------------
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>