xsl-list
[Top] [All Lists]

Re: Re: select distinct

2002-09-17 07:36:40
Thanks for the link, however it stills seems a little over my head. How to
get all the unique <ref/> elements?

<!-- XML snippet -->
<document>
    <section>
        <para>text text text text <ref name="a1" /> text text text.</para>
    </section>
    <section>
        <para>text text text text <ref name="y1" /> text text text.</para>
    </section>
    <section>
        <para>text text text text <ref name="b4" /> text text text.</para>
    </section>
    <section>
        <list type="number">
            <listitem><ref name="a1" /></listitem>
            <listitem><ref name="ko" /></listitem>
            <listitem><ref name="7u" /></listitem>
            <listitem><ref name="y1" /></listitem>
            <listitem><ref name="b4" /></listitem>
        </list>
    </section>
</document>

<!-- Desired output -->
<ref name="a1" />
<ref name="y1" />
<ref name="b4" />
<ref name="ko" />
<ref name="7u" />

I assume my xsl:key element would look like

<xsl:key name="name-of-unique-list" match="ref" use="@name" />

but then how do I make sure I am matching on all ref elements regardless of
where they are located in the document?

what would my xsl:template @match value be?
what would my xsl:for-each @select value be?

<xsl:key name="name-of-unique-list" match="ref" use="@name" />
<xsl:template match="???">
    <xsl:for-each select="???">
        ???
    </xsl:for-each>
</xsl:template>

Thanks for you help
Noel



----- Original Message -----
From: "Dimitre Novatchev" <dnovatchev(_at_)yahoo(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Monday, September 16, 2002 1:28 PM
Subject: [xsl] Re: select distinct



[skip]

I would like to get all the unique <ref /> elements.

<ref name="a1" />
<ref name="a2" />

I am not sure what my xsl should look like to accomplish this.

Thanks
Noel

Read about the Muenchian method for grouping. One place where you can
find this explained is:

http://www.topxml.com/code/default.asp?p=3&id=v20010129150851





=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com

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


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



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