Re: [xsl] concatenate multiple attribute values and assign it to another attribute

Subject: Re: [xsl] concatenate multiple attribute values and assign it to another attribute
From: Abel Braaksma <>
Date: Fri, 30 Mar 2007 00:16:00 +0200
Shaikh, Parvez wrote:
The reason I did that change was when I change it to testnode instead of
//testnode it does not output anything of testnode.

I was talking of a match="//bla" which is never needed (maybe you are thinking of select="//bla", which is sometimes needed, but likely a place for refactoring). If you change this:

<xsl:template match="//bla">


<xsl:template match="bla">

and your code stops working, you should consult your processor's helpdesk, as that is non-xslt behavior.

Please note that
this is a part of a big xsl stylesheet that I am using.

I note that. Which is why I want you to reverse engineer: make a working example with one or both of our examples. Watch it working, learn how xslt does these things. That will bring you closer to how to get it into your big xslt stylesheet.

It begins as

<xsl:template match="/">
<xsl:apply-templates select="//erpayload/* |

well, this is usually a bad design decision as it gives you little flexibility as you by now have found out. It is usually better if you go from XML to a modified XML to use a modified identity template, there are plenty examples in the faq. Then, your code will become much cleaner with templates like this:

<xsl:template match="erpayload">

<xsl:template match="purchasing">


testnode is at erpayload/purchasing/testnode

I cannot change this as it affects many other xml forms

Why not? If you can't change it, you cannot remove any bugs or add any new features. Your starting point of your stylesheet is wrong (well, not wrong, but just very inflexible and not quite usable). Fix that and go from there. And I suggest a good text book, like Jeni Tenison's to help you going with XSLT. It will make life so much easier for you.

-- Abel

Current Thread