Issue in xml transformation with xslt

Posted on 2011-10-24
Last Modified: 2013-11-18
Hi Experts,

Below xslt is fetching complete <Album> node based on the id passed; from my attached xml file

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""
    <xsl:param name="id" select="'tcm:501-638216'"/>
    <xsl:key name="by-id" match="*" use="@id"/>
    <xsl:template match="/">
        <xsl:copy-of select="key('by-id', $id)"/>

this works great.

But when I am passing this xml file after transformation directly to another application, that application is not working good.

But when I copy it and save the xml and then pass to another application, then it works good.

if I remove the transformation code for test and pass the relevany xml from same file, another application works good

Is above code is adding some invisible space or something, which another application is not liking.

Please suggest some solution to fix this xslt or please provide some other xslt solution , might be that will work

Please guide

Many Thanks
Question by:tia_kamakshi
    LVL 60

    Accepted Solution

    This XSLT is perfectly doing what it should do: copying the Album node that has this id

    except... when there would be more nodes bearing the same @id

    no extra spaces are generated
    the only thing likely generated will be the xml declaration.
    you can loose it by setting the omit attribute in the xsl:output as I have shown in your previous question

    Author Closing Comment

    Thanks it works now
    LVL 60

    Expert Comment

    by:Geert Bormans

    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

    Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System ( introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
    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.
    The viewer will learn how to dynamically set the form action using jQuery.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    755 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

    21 Experts available now in Live!

    Get 1:1 Help Now