Re: [xsl] Is this legal xpath usage?

Subject: Re: [xsl] Is this legal xpath usage?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 08:23:16 +0100
Hi Patrick,

> I expect the external function jString:compareTo() to be
> called for each TRACK Element. It is called only once for the 
> first TRACK. 
>
>      <xsl:template match="/" >        
>          <xsl:message>Filtering tracks earlier than 
>  <xsl:value-of select="$trimDate" /></xsl:message>
>          <PRODUCT_LIST PACKAGER="DWS" >
>          <xsl:apply-templates 
>  select="PRODUCT_LIST/PRODUCT[jString:compareTo($trimDate, 
>  rioport:formatDate(./PRODUCT_DETAILS/TRACK/LAST_UPDATE)) &lt; 0]" />
>          </PRODUCT_LIST>
>      </xsl:template>

You're passing a node set consisting of all the LAST_UPDATE elements
to the rioport:formatDate() extension function. I have no idea how
that extension function works, but I suspect that it takes the first
node from that node set and returns a string, rather than formatting
all of them and returning a node set.

I think what you probably want is:

  PRODUCT_LIST/PRODUCT
     [PRODUCT_DETAILS/TRACK
        [jString:compareTo($trimDate,
                           rioport:formatDate(LAST_UPDATE)) &lt; 0]]

This applies templates to:

  the PRODUCT elements that are children of the PRODUCT_LIST element
       that is a child of the current node
    where there is a TRACK element that is a child of the
          PRODUCT_DETAILS element that is a child of the PRODUCT element
       for which the result of comparing the $trimDate to the
         formatted value of the LAST_UPDATE child of the TRACK element
         is less than 0

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread