?
Solved

XSLT help

Posted on 2011-03-09
1
Medium Priority
?
158 Views
Last Modified: 2012-05-11
Hi,

I have the attached XML and I would like to number the child Elements using XSLT.

For eg from the attached XML I need:

1.child
1.1child
1.1.1child


2 child

2.1 child

3 child

3.1 child
InputXML.txt
0
Comment
Question by:Techsavy
[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
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 35093202

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0">
    <xsl:output indent="yes"/>
<xsl:template match="root">
    <html>
        <body>
            <xsl:apply-templates select="child"/>
        </body>
    </html>
</xsl:template>
    <xsl:template match="child">
        <p>
            <xsl:number format="1.1.1.1.1." count="child" level="multiple"/>
            <xsl:text> </xsl:text>
            <xsl:value-of select="name()"/>
        </p>
        <xsl:apply-templates select="child"/>
    </xsl:template>
</xsl:stylesheet>

Open in new window

0

Featured Post

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!

Question has a verified solution.

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

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.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
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…
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

762 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