• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

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"
    <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
  • 2
1 Solution
Geert BormansCommented:
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
tia_kamakshiAuthor Commented:
Thanks it works now
Geert BormansCommented:

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now