[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

using xsl:number

Subject: using xsl:number
From: "Raheja, Dhruv (TRANS)" <Dhruv.Raheja@xxxxxxxxxxxx>
Date: Wed, 23 Aug 2000 15:18:03 -0400
contents using xslt
Hello,
          I am trying to format my table of contents using xsl:number.
however the concept is not very clear to me and hence i am unable to get the
output i want. I hope somebody will be able to help me with this.

my xml code is:


<toc>
	
			<title>
					MAIN COMPONENT 
			</title>
			<break/>
			<toc_num_list>
				<topic toc1="#contactor">
					DC CONTACTOR, 41A296327AM
				</topic>
				
				<toc_num_list>
					<topic toc1="#func_desc">
						Functional Description
					</topic>
					
					<topic toc1="#clean">
						Cleaning
					</topic>
					
					 <topic toc1="#lube">
						Lubrication
					</topic>
					
					<topic toc1="#inspect">
						Inspection
					</topic>
				</toc_num_list>
				
		</toc_num_list>
	</toc>
	<toc>
			<title>
				SUB-COMPONENTS
			</title>
			<break/>
			
			<toc_num_list>
				<topic toc1="#arcchute">
					ARC CHUTE
				</topic>
				
				<toc_num_list>
					<topic toc1="#arc_insp">
						Inspection
					</topic>
					
					<topic toc1="#arc_maint">
						Routine Maintenance
					</topic>
					
					<toc_num_list>
						<topic toc1="#arc_rem">
							Removal
						</topic>
						
						<topic toc1="#arc_inst">
							Installation
						</topic>
						<break/>
					</toc_num_list>
				</toc_num_list>
				<break/>
				<topic toc1="#mc">
						MAIN CONTACTS
					</topic>
					
					<toc_num_list>
						<topic toc1="#mc_insp">
							Inspection
						</topic>
						
						<topic toc1="#mc_maint">
							Routine Maintenance
						</topic>
						
						<toc_num_list>
							<topic
toc1="#mc_rem">
								Removal
							</topic>
							
							<topic
toc1="#mc_inst">
								Installation
							</topic>
							
							<topic
toc1="#mc_algn">
								Alignment
							</topic>
							
							<topic
toc1="#mc_meas">
								Magnetic Gap
Measurement and Adjustment 
							</topic>
							
						</toc_num_list>
					</toc_num_list>
	
				<break/>	
				<topic toc1="#coil">
					COIL
				</topic>
					<toc_num_list>
						<topic toc1="#coil_insp">
							Inspection
						</topic>
						
						<topic toc1="#coil_maint">
							Routine Maintenance
						</topic>
						
						<toc_num_list>
							<topic
toc1="#coil_rem">
								Removal
							</topic>
							
							<topic
toc1="#coil_inst">
								Installation
							</topic>
							
						</toc_num_list>
					</toc_num_list>
					
					<break/>
					
	</toc>

The xsl code is:

<xsl:template match="pub/toc">

	<xsl:apply-templates/>
	
</xsl:template>

<xsl:template match="title">
<h3><xsl:value-of select="."/></h3>
</xsl:template>

<xsl:template match="toc_num_list">
	
	<ol><xsl:apply-templates/></ol>
</xsl:template>
		
<xsl:template match="break">
<br/>
</xsl:template>

<xsl:template match="topic">

<xsl:number format="1.1.1"
		    level="multiple"
		    from="pub/toc/toc_num_list"/>

	<a>
		<xsl:attribute name="href">
			<xsl:value-of select="@toc1"/>
		</xsl:attribute>
	<xsl:value-of select="."/>
	</a>
	<br/>
</xsl:template>


The output that I get is:


MAIN COMPONENT 
	1 DC CONTACTOR, 41A296327AM 
			1 Functional Description 
			2 Cleaning 
			3 Lubrication 
			4 Inspection 
SUB-COMPONENTS 
	1 ARC CHUTE 
			1 Inspection 
			2 Routine Maintenance 
				1 Removal 
				2 Installation 
				

		2 MAIN CONTACTS 
			1 Inspection 
			2 Routine Maintenance 
				1 Removal 
				2 Installation 
				3 Alignment 
				4 Magnetic Gap Measurement and Adjustment 

		3 COIL 
			1 Inspection 
			2 Routine Maintenance 
				1 Removal 
				2 Installation 


However what I need is:

TABLE OF CONTENTS
MAIN COMPONENT 
	1 DC CONTACTOR, 41A296327AM 
			1.1 Functional Description 
			1.2 Cleaning 
			1.3 Lubrication 
			1.4 Inspection 
SUB-COMPONENTS 
	1 ARC CHUTE 
			1.1 Inspection 
			1.2 Routine Maintenance 
				1.2.1 Removal 
				1.2.2 Installation 
				

		2 MAIN CONTACTS 
			2.1 Inspection 
			2.2 Routine Maintenance 
				2.2.1 Removal 
				2.2.2 Installation 
				2.2.3 Alignment 
				2.2.4 Magnetic Gap Measurement and
Adjustment 

		3 COIL 
			3.1 Inspection 
			3.2 Routine Maintenance 
				3.2.1 Removal 
				3.2.2 Installation 

Please advise if possible.

Thanks a lot,
Dhruv

		

Dhruv Raheja
Summer Intern (Documentation Center)
GE Transportation Systems
2901 East Lake Road
Erie, PA 16531
Ph : (814) 875 - 2529 (O)
       (814) 824 - 2888 (R)



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.