xsl-list
[Top] [All Lists]

Re: XSL Unique values

2005-08-31 13:59:23
Hi,

Tempore 22:40:37, die 08/31/2005 AD, hinc in 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Prakash R 
<raghits(_at_)yahoo(_dot_)com>:

Is there any way using XSL I can get the unique
metadata[(_at_)fieldid=3]/fieldvalues for each product. I
know I can do it across the entire XML doc. In this
example for product(name=shirt) it would be RG,LN and
SM , product(name=t-shirt) it would be AA,BB,CC,DD,EE.
I want to be able to get these separately for each
product and iterate through it within the product if
possible.

Close examination of a working sample (such as below) is always the best method 
to learn in my opinion...

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:key name="metadata" match="metadata"
        use="concat(generate-id(ancestor::product),@fieldid,fieldvalue)"/>

<xsl:template match="product">
<xsl:value-of select="name"/>:

<xsl:for-each select=".//metadata[generate-id(
        key('metadata',concat(generate-id(current()),3,.))[1])=generate-id()]">
        <xsl:value-of select="fieldvalue"/>-
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>



regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
«Numquam mores quos extuli refero»  - Seneca , Ad Lucilium I, 7

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>