🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.xml
Article #42

Re: Expert XML/XSL?

#42
From: Carl Ranson
Date: Tue, 13 Feb 2001 20:43
89 lines
4953 bytes
Surely its just something along the lines of:

<xsl:template match="Party">
    <xsl:if test="@PartyType[.!value()='B']">
            <xsl:foreach select="ContactDetail">
                <xsl:value-of ....(your stuff here) />
            </xsl:foreach>
    </xsl:if>
</xsl:template>

alternatively you could do it with another template.

<xsl:template match="ContactDetail">
        (your stuff here)
</xsl:template>

<xsl:template match="Party">
    <xsl:if test="@PartyType[.!value()='B']">
            <xsl:apply-templates/>
    </xsl:if>
</xsl:template>

The fact that you said you just get the details twice leads me to belive
you've simply put the value-of in twice. The problem is that the current
node (ie the ContactDetail you're on) hasn't changed. The foreach or apply
templates causes the thing to evaluate for the different nodes.

Hope all this helps, email me if you still cant get it going
(the_nutcase@hotmail.com).

Cheers,
Section8

"Mike Bowling" <mikebowling@hotmail.com> wrote in message
news:3A8985A9.17D30658@hotmail.com...
> Are you the expert that can help me with an XML/XSL prob?  Here it is:
>
> I have element(s) "Party" in my xml doc
>
>                 <Party PartyType="A" ID="003439" UDF1="Schultz"
> Name="Boise Property Appraisers" UDF3="B328">
>                         <ContactDetail ContactPointRole="WORK"
> ContactPointType="PHONE" Value="(301) 557-2366"/>
>                         <ContactDetail ContactPointRole="WORK"
> ContactPointType="EMAIL" Value="alex@boise.net"/>
>                         <PersonName LastName="Appraiser" FirstName="Alex
> "/>
>                         <Address StreetAddress1="45 East Wilkes Street,
> Suite 14" City="Boise" State="ID" County="Boise" Zip="78620"/>
>                 </Party>
>                 <Party PartyType="B" ID="003438" UDF1="Schultz"
> Name="ABC Mortgage Co" UDF3="B328">
>                         <ContactDetail ContactPointRole="WORK"
> ContactPointType="PHONE" Value="(302) 478-8617"/>
>                         <ContactDetail ContactPointRole="WORK"
> ContactPointType="EMAIL" Value="jjones@aol.com"/>
>                         <PersonName LastName="Smith" FirstName="John "/>
>
>                         <Address StreetAddress1="330 Pike St"
> City="Wilmington" State="DE" County="Unknown" Zip="19802"/>
>                 </Party>
>
>
> I needed to show values only from the second element and did it this
> way:
>
>                         <xsl:if test="@PartyType[.!value()='B']">
>
> and then listed the variables I wanted, ie...
>
>                         <xsl:value-of select="PersonName/@FirstName"/>
>
>                                 ...and so on, and it works fine
>
> HOWEVER, now I need to show both ContactDetail/@Value values (inside
> PartyType B), the phone and the email addy.  My problem is it shows only
> the first, and if I try to make it show both, it only lists the phone
> number twice.
>
> Aaaaargh!  I've been trying to solve this for two days, what am I
> missing?.  HELP!
>
> There's a beer (or your choice of beverage, etc.) in it for whoever can
> help...
>
> Thanks,
> MikeMonster
> mikebowling@hotmail.com
>
Technical Details
Message-ID: <00hi6.7715$4a.217579799@news.xtra.co.nz>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-04!supernews.com!216.227.56.88.MISMATCH!telocity-west!TELOCITY!enews.sgi.com!news.xtra.co.nz!not-for-mail
References: <3A8985A9.17D30658@hotmail.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1061e4,5ddd98be2aed77fc
X-Google-Attributes: gid1061e4,public
X-Google-Thread: 1047a4,5ddd98be2aed77fc
X-Google-Attributes: gid1047a4,public
X-Google-Thread: 107178,5ddd98be2aed77fc
X-Google-Attributes: gid107178,public
X-Google-Thread: 10cf80,5ddd98be2aed77fc
X-Google-Attributes: gid10cf80,public
X-Google-Thread: 114f60,5ddd98be2aed77fc
X-Google-Attributes: gid114f60,public
X-Google-Thread: 10df13,5ddd98be2aed77fc
X-Google-Attributes: gid10df13,public
X-Google-Thread: 1006ac,5ddd98be2aed77fc
X-Google-Attributes: gid1006ac,public
X-Google-Thread: fa6ce,5ddd98be2aed77fc
X-Google-Attributes: gidfa6ce,public
X-Google-ArrivalTime: 2001-02-13 12:43:41 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-04!supernews.com!216.227.56.88.MISMATCH!telocity-west!TELOCITY!enews.sgi.com!news.xtra.co.nz!not-for-mail
From: "Carl Ranson" <the_nutcase@hotmail.com>
Newsgroups: comp.text.xml,microsoft.public.windows.inetexplorer.ie5.programming.xml,microsoft.public.xsl,microsoft.public.xml,borland.public.xml,ibm.software.developerworks.xml.newbies,microsoft.public.dotnet.xml,fr.comp.text.xml
References: <3A8985A9.17D30658@hotmail.com>
Subject: Re: Expert XML/XSL? 
Lines: 91
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <00hi6.7715$4a.217579799@news.xtra.co.nz>
Date: Wed, 14 Feb 2001 09:43:09 +1300
NNTP-Posting-Host: 210.55.57.2
X-Complaints-To: newsadmin@xtra.co.nz
X-Trace: news.xtra.co.nz 982097020 210.55.57.2 (Wed, 14 Feb 2001 09:43:40 NZDT)
NNTP-Posting-Date: Wed, 14 Feb 2001 09:43:40 NZDT
Organization: Xtra