[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Yet Another Flat File to Hierarchy question..

Subject: RE: Yet Another Flat File to Hierarchy question..
From: "Paul Bunkham" <paulb@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Jun 2002 08:52:58 +0100
paul bunkham
Thank you wendell, I'd been working on something similar, but it would
appear the the use of current() was the key to success (no pun intended
:) ).

Just for the record, the working line of code is:

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

Thanks again,

Paul.

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Wendell Piez
Sent: 13 June 2002 18:23
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: 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@xxxxxxxxxxxxxxxx
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


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.