Solved

XSLT help

Posted on 2011-03-09
1
151 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
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
Comment Utility

<?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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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 …
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now