Issue in xml transformation with xslt

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="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="1.0">
    <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)"/>
    </xsl:template>
   
</xsl:stylesheet>


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
ImageGallery.xml
tia_kamakshiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Geert BormansInformation ArchitectCommented:
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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tia_kamakshiAuthor Commented:
Thanks it works now
0
Geert BormansInformation ArchitectCommented:
welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.