Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2008, 02:58 PM
Registered User
 
Join Date: Feb 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default attribute list

Hello,

Is it possible to get a list of all possible attributes for a specific node ? Later I would like to iterate through this list and do some transformations.

As for now, I "dumbly" list each attribute, e. g.

<xsl:value-of select="count(header/language[@lang='DE']/entry)"/>
<xsl:value-of select="count(header/language[@lang='FR']/entry)"/>

and so on.

Thank you for your help

 
Old February 17th, 2008, 03:11 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can't list all the attributes that could possibly appear on an element, but you can list those that actually do appear using @*

But perhaps I've misunderstood your question, and it's not the set of attribute names that you are interested in, but the set of attribute values. This starts to look like a grouping problem:

<xsl:for-each-group select="header/language" group-by="@lang">
  <xsl:value-of select="count(current-group()/entry)"/>
</xsl:for-each-group>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 17th, 2008, 03:23 PM
Registered User
 
Join Date: Feb 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Michael,

Sorry you were right, I didn't express myself clearly. Yes, I'm interested in all the possible value of an attribute. I will implement the code snippet you provided me, it seems to do exactly what I was trying to achieve.

Thank you






Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace an attribute with another attribute georgemeng XSLT 8 June 10th, 2008 11:04 AM
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
Access to attribute values from class of attribute jacob C# 1 October 28th, 2005 01:11 PM
List tablesname from database & list databasename ittorget MySQL 3 September 10th, 2005 03:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.