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

unique attribute values in XSLT2 - storing them in a

Subject: unique attribute values in XSLT2 - storing them in a variable
From: <jozef.aerts@xxxxxxxxxxxxxx>
Date: Tue, 22 Feb 2005 11:52:04 +0100
xslt unique attribute values
Dear all,

I am making the transition now from XSLT1 to XSLT2

I have the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<A at1="1" at2="2">
	<B atb="3">
		<C atc="a"/>
		<C atc="b"/>
	<B atb="3">
		<C atc="a"/>
		<C atc="c"/>

I need to find all unique values of the @atc attribute, and store them
in a variable for later use.
That was no problem in XSLT1, but I still have some problems in XSLT2.

This is what I have:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	<xsl:template match="/">
		<xsl:apply-templates select="A"/>
	<xsl:template match="A">
	<xsl:for-each-group select="B/C"
    		<xsl:sort select="." />
    		<xsl:value-of select="." />
    		<xsl:for-each select="distinct-values(current-group()/@atc)">
      			distinct @atc = <xsl:value-of select="." />

This indeed gives:
distinct @atc = a
distinct @atc = b
distinct @atc = c

But how do I store these values in a variable for later use ?

Many thanks in advance


Current Thread


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.
First Name
Last Name
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.