xsl-list
[Top] [All Lists]

RE: [xsl] Filtering a node-set

2008-01-10 09:28:40
 
      <xsl:variable name="boxSize" select="'0.002'"/>

     <xsl:for-each select="$elements">
          <xsl:variable name="top"    select="@lat + 90  + 
$boxSize "/>
          <xsl:variable name="bottom" select="@lat + 90  - $boxSize"/>
          <xsl:variable name="left"   select="@lon + 180 "/>
          <xsl:variable name="right"  select="@lon + 180 + $boxSize
+$boxSize"/>
          <xsl:if test="count($elements[(@lon+180) &lt; $right and
(@lon+180) &gt; $left and (@lat+90) &lt; $top and (@lat+90) 
&gt; $bottom])=0">
                  <xsl:copy-of select="."/>
          </xsl:if>
     </xsl:for-each>


XPath 1.0 is not relationally complete (XPath 2.0 is). You're doing a join
here which, I beleive, sits in the subset of predicate calculus that falls
outside the boundaries of what XPath 1.0 can do. This was the reasoning that
led us to introduce the "for" expression and range variables into XPath 2.0,
despite many people saying it added unnecessary complexity. 

So you can't do it in XPath 1.0, and without the node-set extension, I don't
think you can do it in XSLT 1.0 either.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>