|
Subject: Filtering the nodes passed to a template... From: "Callum Elliott" <c.j.elliott-96@xxxxxxxxxxxxxxxxxxx> Date: Fri, 31 Mar 2000 10:24:31 +1100 |
Thanks for the reply Mike,
I'm still having problems though...perhaps if I explain it more cleary...
This is my XML:-
<report>
<payments>
<payment id="..."/>
<payment id="..."/>
</payments>
<paymentTypes>
<paymentType paymentTypeRef="..." desc="..."/>
<paymentType paymentTypeRef="..." desc="..."/>
</paymentTypes>
</report>
Basically, I want to
1. print out all the @paymentTypeRef and @desc only if the @paymentTypeRef
matches a payments/@id
2. if the @paymentTypeRef matches the one printed before it, I only want the
@desc displayed
...So in the end, my output will look like this
PaymentType Desc
CASH Cash
CCDEBTOR Amex
Visa
Diners
CHEQUE Cheque
I can do no.1 fine with the following line...
<xsl:apply-templates select="paymentType[@paymentTypeRef =
/report/payments/payment/@id]">
and in that template I use...
<xsl:if test="@paymentTypeRef !=
../preceding-sibling::paymentType/@paymentTypeRef]">
<xsl:value-of select="@paymentTypeRef"/>
</xsl:if>
but this seems to reference the original XML and not the filtered XML which
is passed into the template. So I need a way of accessing and testing
values in the filtered node set, and not the original.
Thanks again,
Callum
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Filtering the nodes passed to a, Mike Brown | Thread | String comparision in XPath, Sven Kuenzler |
| RE: replacing character by another , Ron Ten-Hove | Date | reposting questionFW: a kind of sil, Neelam Checknita |
| Month |