Trim XML output with xsl

Posted on 2006-05-01
Last Modified: 2008-03-17
I have an xml element <day>SUN</day> that I am parsing with asp and outputting to a wireless app that I need to trim so that the output is 'SU'
Question by:mauler
    1 Comment
    LVL 60

    Accepted Solution

    Hi mauler,

    if you just need the first two characters, it is pretty simple

        <xsl:template match="day">
            <xsl:value-of select="substring(.,1,2)"/>

    if you need a specific mapping, individually for each day,
    it requires a bit more work,
    let me know if that is the case


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    XML problem with Internet Explorer 7 22
    Some of the XML elements or attributes 5 24
    .net c# 8 42
    JPA XML tag definition 2 48
    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    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. 
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    733 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

    17 Experts available now in Live!

    Get 1:1 Help Now