Re: XSL queston

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Alan Dayley
Date:  
To: plug-discuss
Subject: Re: XSL queston
On Sunday 15 August 2004 11:23 pm, Derek Neighbors wrote:
> Have you tried "(position() mod 4) = 1" ?
>
> On Sun, 2004-08-15 at 08:11, Alan Dayley wrote:
> > ...
> > <xsl:template match="/Thumbs/Photo">
> > <xsl:if test="(position() mod 10) = 2">
> >     <xsl:text disable-output-escaping="yes">&lt;tr class="fulltablerow"
> > &gt;</xsl:text>
> > </xsl:if>
> > <td width="1" class="fulltablecolumn">
> >     <table class="phototable">
> >         <tr class="phototablephotorow">
> >             <td class="phototablephotocolumn">
> > ...


I don't recall that combination.

I have proven through prints to the resulting web page that the operation of
the XSL script causes it to come to the <xsl:if test... line on even numbered
positions. ie. when postition() returns 2, 4, 6, 8, 10, etc. Thus, the
original test "(position() mod 10)" equals 2 every 5th interation:

2 4 6 8 0 2 4 6 8 0 2 4 6

Thus triggering the insert of "class-"fulltablerow"" every 5th time through
the interation. (I don't know why the first value of 2 does not "count" but
it does not seem to effect the resulting web page. I really need to learn
more XSL and decode the whole file if I am going to pursue this!)

Anyway, your question inspired me to build a spreadsheet with possible values
for the mod function as applied to the even numbered position iterations.
(Should have done that before.) I did position values to 26 and mod values
of 1 through 30.

Your suggested "(position() mod 4) = 1" would be true never since it only
produces values alternating between 0 and 2 (You would not have known that
since I did not inform you that the position() call reponds with only even
numbers at this point in the code.).

By the calculations, a mod value of 8 ie. "(position() mod 8) = 2" should work
since it gives a result value pattern of:

2 4 6 0 2 4 6 0 2 4 6 0 2

BUT, I have tried 8 as the value and got a page with varying numbers of
thumbnails per row: first 4 then 1, 2, 2, 3, 2, etc.

Hmm... When I get around to caring enough about it, I'll have to study the
entire XSL file and learn what is going on. There must be some other place
where some control is happening to adjust the number of items in a row. The
odd numbered position values are beeing used somewhere! I got around the
problem by producing the pages with a different method so it is not holding
my interest anymore. I am still curious but debugging XSL is not a skill I
have time to learn fully right now.

Thanks for the response.

Alan
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss