This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: automatic generation of figure numbers


Dhruv:

I'm inclined to concur with Mike on this. I've been following this thread, 
trying to think how I could weigh in usefully, only seeing others have been 
trying to help in various ways to no avail.

Mike already posted a solution in which the figure number is generated 
based on counting your <figure> elements, _except_ the ones that point to 
the same file as a previous <figure> element does. While a bit convoluted, 
this should work, and in fact is the most straightforward and elegant 
solution to the problem as you have stated it.

It's convoluted because your model basically has the <figure> element doing 
double duty. In some cases, it refers to a file to be referenced as a 
figure. In other cases, it refers to a _figure_ (as an abstraction -- you 
have many <figure> elements for one figure), but indirectly, by referring 
to a file that happens already to be referred to by an earlier <figure> (of 
the first type). The only way to tell the difference between these two 
things (necessary to assign the right numbers) is for the stylesheet to 
give the processor the logic to figure it out at runtime.

The usual alternative is what Sebastian suggested. Model elements that 
refer to external files as figures (say, <figure file="mypicture.gif" 
name="mypic"/>), and model _other_ elements as references to those figures 
as they appear inline in the text (say, <figref figure="mypic"/>). 
Processing becomes much easier: your counting is very straightforward, you 
can move figures and their references throughout the text with impunity. 
There are other longer-term advantages for maintainability etc. as your 
processing or documents become more complex.

This is a good case where how you model the document can make a big 
difference downstream. The (seemingly) more complex model actually becomes 
simpler to use as well as more flexible, once you get used to it, because 
it more directly reflects the processing logic that a writer will get (and 
will come to expect).

If you have no choice about the model (maybe someone else is designing it, 
or too much has been marked up to go back and fix), then Mike's earlier 
solution should work -- although you do have to get your head around how to 
code the numbering. Once you succeed at doing that, however, you could 
write a stylesheet that would convert documents using the first model into 
ones using the second.

Good luck,
Wendell

ps. readers will please forgive any funky formatting, as I'm trying out a 
new Eudora and haven't gotten it all set up right yet....?

At 08:53 AM 10/6/00 +0100, you wrote:
>I'm inclined to agree with the other respondents who have suggested that you
>approach the problem a different way.
>
>Mike Kay
>
> > -----Original Message-----
> > From: Dhruv Raheja [mailto:dhruv_r@hotmail.com]
> > Sent: 05 October 2000 22:06
> > To: XSL-List@mulberrytech.com
> > Subject: Re:automatic generation of figure numbers
> >
> >
> > Hello All,
> >            Mike, I was going through your book yesterday and
> > coincidently
> > came up with the same solution that you had suggested.
> > However I am unable
> > to get the desired output. The first two figures are numbered
> > correctly. The
> > third figure should be numbered 1 again but for some reason,
> > it generates
> > "125". I'm not able to figure it out. Hope you can help.
> >
> > Thanks,
> > Regards,
> > Dhruv
> >
> > ______________________________________________________________
> > ___________
> > Get Your Private, Free E-mail from MSN Hotmail at
>http://www.hotmail.com.
>
>Share information about yourself, create your own public profile at
>http://profiles.msn.com.
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


======================================================================
Wendell Piez                            mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]