xsl-list
[Top] [All Lists]

Re: [xsl] Create Table

2010-03-30 14:32:11
HI Eric,  as always thanks for your help!

I am getting so close.  What you gave me didn't completely solve the problem, 
but it helped me to think what the context is, and I did some more research to 
get the table looking like I wanted.  (Not sure if it is the best way to do it, 
but I can worry about that later).  

So I have my table built with all the source changes, now I want to add a row 
with the 'diffs' for each change(could be 30 or more nodes).  The challenge is 
after i have grabbed  the the File, version, date etc for the first row,  I 
need to then somehow grab all the data nodes where @field=diff, until the next 
node where @field!=diff, and place it in the next row.  Off topic, I plan on 
using JavaScript to hide the diff detail unless use wants to see it.  Seems 
like a while loop, but I know those don't exist.  I also am currently 
experimenting with named templates, although struggling with how to set 
context.  

Sorry this is so muddled, let me know if you need clarifications.  
Thanks again,

Bernie



----- Original Message ----
From: Eric J. Bowman <eric(_at_)bisonsystems(_dot_)net>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: bernie bonn <moochambo(_at_)yahoo(_dot_)com>
Sent: Sat, March 27, 2010 3:22:26 AM
Subject: Re: [xsl] Create Table


So this answer extends the example already given, by adding the number
() function.


Heh, don't listen to me, I'm still learning myself... number() isn't 
needed here, as this works just fine:

<th><xsl:value-of select='./@lineId+1'/></th>

What I've just learned, is that I need to take a closer look at how
XSLT processors handle typing, my answer assumed number() was needed in
order to perform addition like you were trying, and was thus totally 
wrong.

Anyway, I played around with it a bit more, adding this to my <tr>
template:

<xsl:param name='x' select='./@lineId'/>

And changing the <th> two different ways, as follows:

<th><xsl:value-of 
select='following-sibling::data[(_at_)lineId=$x]/@lineId'/></th>
<th><xsl:value-of 
select='following-sibling::data[(_at_)lineId=$x+1]/@lineId'/></th>

The first line results in <th/>, the second line works as expected.
The first line can be rewritten as select='//data[(_at_)lineId=$x]/@lineId' 
and it will work as expected.  So I suspect your problem is one of not
minding your context node, i.e. you started with this:

<xsl:param name='x' select='./@lineId'/>

Then, you have <xsl:value-of select='data[(_at_)lineId=$x]'/>, which can't 
work  because you haven't selected an axis...  So it's hard to know how 
to specifically help you here -- the 'data[(_at_)lineId=$x]' is correct, but 
only if it's preceded by a proper axis, and followed by '/@lineId' since 
you're after attribute content, instead of element content.

-Eric



      

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