Solved

Multi level numbering with a XSL

Posted on 2000-03-17
8
176 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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