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

Re: Is it possible to merge attributes from multiple element

Subject: Re: Is it possible to merge attributes from multiple elements?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Sun, 18 Jun 2000 09:42:29 +0100
xml xslt merge attributes
Andy,

Your problem lies in the line where you set the $attrs variable:

  <xsl:variable name="attrs"><xsl:value-of select="@*"/><xsl:variable>

When you set a variable using the *content* of the xsl:variable element, the content is converted into a 'result tree fragment'.  Result tree fragments are like clips of output: you can slot them into your output, but (in standard XSL) you can't process them as input.  The things you *can* process as input are 'node sets'.  The reason your XSL processors are complaining is that you're implicitly converting the result tree fragment into a node set when you try to iterate over its contents.

You want to set your $attrs variable to the *node set* that contains the attributes of the 'row' element, so that you can iterate over them later and include them on your table cells.  The way that you do this is to use the 'select' attribute on xsl:variable:

  <xsl:variable name="attrs" select="@*" />

Making this change makes your template work in SAXON.

So, basically, if you're using a variable to identify specific nodes for processing, then use the 'select' attribute, but if you're using it to hold a clip of output, use the content.

I hope that helps,

Jeni

P.S. An alternative approach is to convert your result tree fragment into a node set using an extension function, but if you can solve a problem without using an extension function, then you may as well do so.

Dr Jeni Tennison
Epistemics Ltd * Strelley Hall * Nottingham * NG8 6PE
tel: 0115 906 1301 * fax: 0115 906 1304 * email: jeni.tennison@xxxxxxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

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-2013 All Rights Reserved.