This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: select distinct


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@yahoo.com>
To: <xsl-list@lists.mulberrytech.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]