Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Multi level numbering with a XSL

Posted on 2000-03-17
8
Medium Priority
?
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 600 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
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. 
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

604 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