[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: concatenate multiple attribute values and assign i

Subject: Re: concatenate multiple attribute values and assign it to another attribute
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 30 Mar 2007 00:16:00 +0200
Re:  concatenate multiple attribute values and assign i
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">

to

<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="/">
<erpayload>
<xsl:apply-templates select="//erpayload/* |
//erpayload/purchasing/*"/>

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:apply-templ....

<xsl:template match="purchasing">
 <xsl:apply-templ....

etc.


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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.