Here is an excerpt of my input xml. I need to create an exact copy of this xml with only one change – the value of the element <FinancialNumber> should be formatted as a string of 5 characters – for example, in this case 1 should be replaced with “00001”. There are multiple occurrences of this element across the file. Any help would be appreciated.


Recommended Answers

All 2 Replies

You need something like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""
    xmlns:xs="" exclude-result-prefixes="xs" version="1.0">
    <xsl:template match="node()|@*">
            <xsl:apply-templates select="@*"/>
    <xsl:template match="FinancialNumber">
            <xsl:number value="." format="00001"/>

Cheers, John Bampton

John - It works great. Thanks !!


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.