xsl-list
[Top] [All Lists]

[xsl] Filtering a node-set

2008-01-09 04:10:13
I have a variable containing a node-set.  Each element in the node-set has a
lat and lon attribute and I have a template that filters elements in the
node-set based on their proximity to other elements:
 
      <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>

The output of this template is an rtf.  I'd like the output to be a node-set
so that I can then further manipulate the results.   I need this to run in
xslt1 without using extensions so I can't just use an extension to convert
the rtf to a node-set.
 
Is there a way of re-expressing the above template as an xpath expression
that would return a node-set?  I can't see a way of eliminating the use of
the $top, $bottom, $left and $right variables.  Is it possible?
 
Regards
George

George James Software
www.georgejames.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>