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]
Other format: [Raw text]

Re: Yet Another Flat File to Hierarchy question..


Paul,

Two possibilities:

In principle, I don't see why a key declaration would be impossible of the form:

<xsl:key "get-next-level" match="p" use="generate-id(preceding-sibling::p[@style &lt; current()/@style][1]"/>

I've never seen the current() function in a key declarations 'use' attribute, but don't suppose (at first blush) it's illegal.

Alternatively, you could write a stylesheet running over the source that would generate the "levitation" stylesheet (my name, no one else uses it, *sniff*) to run over the source. Somewhat monstrous, perhaps, but conceivable.

Alternatively, if your complete data set (your entire document repository) is bounded, you could find out what the absolute min and max is, and code to that.

In between would be to code for the deepest you have ever seen and have exception-trapping in your stylesheet to warn you if you ever have a document that goes deeper (necessitating some maintenance, which naturally would get more and more seldom).

Cheers,
Wendell

At 05:41 AM 6/13/2002, you wrote:

My problem is this. My sttributes are numerical depicting the depth the tag
should be placed at, e.g.:

<p style="1">Top Level Heading</p>
<p style="2">Sub Heading 1</p>
<p style="2">Sub heading 2</p>
<p style="3">Sub Heading 3</p>
<p style="4">Sub Heading 4</p>
<p style="1">Another Heading</p>

I can get this to work fine by adapting the key definitions in Jeni's
algorithm.  However, in the application that I am using this, I do not
necessarily know in advance the maximum and minimum level value.  I have
implemented a min and max function to retrieve these values, but I need to
generate the key look-up tables based on these values.  Is this possible?
and if so does anyone have an idea as to how to do it?

======================================================================
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]