Subject: RE: [xsl] Yet Another Flat File to Hierarchy question.. From: "Paul Bunkham" <paulb@xxxxxxxxxxxxxxxxxxx> Date: Fri, 14 Jun 2002 08:52:58 +0100 |
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 < 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: [xsl] 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 < 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Yet Another Flat File to , Wendell Piez | Thread | [xsl] How can i compare tags in two, Sudhakar Bijjam |
Re: [xsl] FO questions about blocks, G. Ken Holman | Date | RE: AW: [xsl] Problem parsing cp125, bryan |
Month |