Solved

Multi level numbering with a XSL

Posted on 2000-03-17
8
174 Views
Last Modified: 2006-11-17
I am trying to learn XML.  In specific I would like to learn how to us a XSL to to numbering.  The below is just a made up example of a xml structure.  Following that is the numbering I would want to achieve from the XSL.  I am sorry for being specific but I am slow and want to learn and this would help me greatly.  I doubt I would ever have a number scheme this complicated so if I learn this I will be a happy person.


<sect>
<stitle>Handbook Information</stitle>
      <topic>
      <ttitle>Introduction></ttitle>
      <paragraph>here is some information</paragraph>
            <stopic>
            <stitle>How To Use This Book</stitle>
            <procedure1>
            <p1item>Use Table of Contents</p1item>
                  <procedure2>
                  <p2item>list of figures</p2item>
                  <p2item>list of tables</p2item>
                  </procedure2>
            </procedure1>
                  <para1>
                  <p1title>General Information</p1title>
                  <paragraph>here is some information</paragraph>
                        <para2>
                        <p2title>Specific Information</p2title>
                        <paragraph>here is some information</paragraph>
                        </para2>
                  </para1>
            </stopic>
      </topic>
</sect>


(Numbering to keep track of multiple <sect>)

Section 1 Handbok Information
1.1 Introduction
here is some information
1.1.1 How To Use This Book
1. Use Table of Contents
1a. list of figures
1b. list of tables
1.1.1.1 General Information
here is some information
1.1.1.1.1 Specific Information
here is some information
0
Comment
Question by:rtho7
8 Comments
 
LVL 2

Expert Comment

by:meming
ID: 2632124
How much do you know about XSL? I have done something similar. Need to know if you need all the code. BTW, it's important to provide info about your environment -- which XSL implementation, IE5, Saxon, or XT?
0
 

Author Comment

by:rtho7
ID: 2632245
I do not know alot about XSL.  I was looking at a lot of things and was wondering if <xsl:number count="stitle|ttitile|stitle|p1title|p2title">  I do not know how to work this in and if I can work in procedures.

I am working in IE5 environment.  I would like all the code if you could please.  

Thanks
0
 
LVL 1

Expert Comment

by:drom
ID: 2633098
rtho7, in ie5 you can do this with xsl script:
look for <xsl:eval>, <xsl:script> elements and depth(), childNumber() methods.
http://msdn.microsoft.com/library/psdk/xmlsdk/xslr8ko5.htm
sorry, I have no time to elaborate it now. Regards, Dmitry.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 27

Expert Comment

by:BigRat
ID: 2634084
I would suggest that you buy yourself a copy of the booklet "XML: A Pocket Reference" by Robert Eckstein, published by O'Reilly, ISBN 1-56592-709-5. Pages 49-55 deal exclusively with *EXACTLY* what you want to do. It is a bit too much to type in here. The book costs *ONLY* $8.95. You can prbably order it from amazon.com if its not in your local bookstore. It is also a useful handy reference, particularly since I can't remember the syntax of things!
0
 

Author Comment

by:rtho7
ID: 2642999
I will buy the book you suggested Big Rat.

I will dive into the web site suggest drom.

However I would like to see a simple example with just two or three levels.  This way other including mself will have something to reference.
0
 
LVL 27

Expert Comment

by:BigRat
ID: 2646291
Let us assume that <paragraph> elements are always contained in <chapter> elements, the following format :-

    <xsl:number count="chapter|paragraph" format="1.1">

gives :-

1.1
1.2
1.3
2.1
2.2
2.3
and so on.
0
 
LVL 27

Accepted Solution

by:
BigRat earned 200 total points
ID: 2646298
(You of course put the <xsl:number> in the <xsl:for-each> loop) (and of course you can have lots of really cool formats and the count can consist of many elements concatenated with |).
0
 

Author Comment

by:rtho7
ID: 2647598
Thanks for the help everyone.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question