Solved

Multi level numbering with a XSL

Posted on 2000-03-17
8
173 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

929 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now