Solved

Multi level numbering with a XSL

Posted on 2000-03-17
8
171 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:rtho7
Comment Utility
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
Comment Utility
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
Comment Utility
(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
Comment Utility
Thanks for the help everyone.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

13 Experts available now in Live!

Get 1:1 Help Now