Re: XSL Problem

Subject: Re: XSL Problem
From: "James Tauber" <jtauber@xxxxxxxxxxx>
Date: Mon, 8 Mar 1999 16:21:57 +0800
>Ok I have
>
><nodeType1 att1='thing1'>
><nodeType2 att1='thing2'>
><nodeType3 att1='thing3'>
>
>I am trying to select all 3 nodes and orger by att1 but display different
>information depending on what type of node it is?
>
>Does anyone have any idea how i would do this


Assuming you have a container element X, ie

<X>
    <nodeType1 att='thing1'>
    <nodeType2 att='thing2'>
    <nodeType3 att='thing3'>
</X>

Then you could have

<xsl:template match="X">
    <xsl:apply-templates select="nodeType1|nodeType2|nodeType3">
        <xsl:sort select="@att1"/>
    </xsl:apply-templates>
</xsl:template>

<xsl:template match="nodeType1">...</xsl:template>
<xsl:template match="nodeType2">...</xsl:template>
<xsl:template match="nodeType3">...</xsl:template>

I haven't tested it, but I think it should work.

James
--
James Tauber / jtauber@xxxxxxxxxxx / www.jtauber.com
Associate Researcher, Electronic Commerce Network
Curtin University of Technology, Perth, Western Australia

Full-day XML Tutorial @ WWW8 : http://www8.org/

Maintainer of : www.xmlinfo.com,  www.xmlsoftware.com and www.schema.net



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


Current Thread