Re: [xsl] local variable problem...again!!!

Subject: Re: [xsl] local variable problem...again!!!
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 21 Aug 2002 12:27:28 -0600 (MDT)
aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx wrote:
> 	An XSL sheet is generating a table in which the tr tag takes a
> onclick attribute which takes the text of all the td tags concatenated as
> one string as parameter... The problem is how do I retrieve that
> concatenated string (variable named anchordata) to be passed as a parameter
> as I do not have an assignment statement here.....!!! 
>
> [stylesheet removed]

Your problem is pretty difficult, and I think the language barrier is
preventing you from explaining it with clarity. Let me see if I can re-explain
your original problem a little more clearly, so that maybe you can get a
better response and so that you don't have to worry about details that you are
asking about now. In the future, it would help if, for purposes of getting
assistance on the list, you distilled your problem down to the simplest
example, like I am trying to do here.

If I remember correctly, you have a table defined in XML as 'Row' elements,
with cell contents defined in attributes having names with explicit column
numbers in them, like this:

<Row c1="one" c2="two" c3="three"/>
<Row c1="uno" c2="dos" c3="tres" c4="cuatro"/>

...and you just need to output an HTML table row for each of these,
taking into account the maximum number of columns, like this:

<tr>
  <td>one</td>
  <td>two</td>
  <td>three</td>
  <td>&#160;</td>
</tr>
<tr>
  <td>uno</td>
  <td>dos</td>
  <td>tres</td>
  <td>cuatro</td>
</tr>


You did not say this, but I am guessing that sometimes your data skips
columns, like this:

<Row c2="two" c5="five" c7="seven"/>

which would need to result in something like this:

<tr>
  <td>&#160;</td>
  <td>two</td>
  <td>&#160;</td>
  <td>&#160;</td>
  <td>five</td>
  <td>&#160;</td>
  <td>seven</td>
</tr>

Is this correct? Because this is what makes the problem a lot harder, since
you can't just iterate over the column attributes in sorted-by-name order and 
assume that the position matches the column number.

In addition, I am inferring from your stylesheet that you need to be able to
use an 'offset' parameter that specifies a number of initial Row elements to
skip, and another variable that specifies a maximum number of Row elements to
process. I am guessing that you need these things because you are invoking the
transformation multiple times, once for each 'page' of data. This may or may
not be wise, but I don't know enough about your application to say for sure,
so I'll assume it's OK.

Tell us (on the list) if this is a good summary of your problem, and if you're
still having trouble figuring out a good solution. I'm sure someone (probably 
not me, though) will step forward and help you. Good luck.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread