xsl-list
[Top] [All Lists]

sorting and 0 div boolean

2006-02-14 11:24:06
This code worked but now it doesn't work.   We had a software upgrade
and our processor is contained within the other software.  When the sort
worked we were using Saxon 6.4.2.  We're now using Saxon 7.7.  This code
still works in the old version, but not in the new.  This code now
returns a parse error, "Division by zero."  I read the FAQ about
'Division by zero' but format-number doesn't help me here. 

Is there another way to sort this and ignore the stop words I have here?
The problem section of my xsl is here, followed by a snippet of the xml
I'm trying to transform.
Thanks,
Susan Campbell
scampbell(_at_)cclaflorida(_dot_)org

<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
   xmlns:sw="http://my.stopwords/sw";
   exclude-result-prefixes="sw">

<sw:stop>
   <word>the</word>
   <word>a</word>
   <word>an</word>
</sw:stop>

<xsl:variable name="stop-words"
select="document('')/xsl:stylesheet/sw:stop/word"/>
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUV'"/>

<xsl:template match="/">
<xsl:call-template name="header"/>
     <xsl:for-each select="//section-02/title">
     <xsl:sort select="concat(substring(substring-after(.,' '), 0 div
boolean
             ($stop-words[starts-with(translate(current(), $uppercase,
$lowercase), 
             concat(translate(., $uppercase, $lowercase), ' '))])),
substring(., 0 div not
             ($stop-words[starts-with(translate(current(), $uppercase,
$lowercase), 
             concat(translate(., $uppercase, $lowercase), ' '))])))"/> 
          <xsl:if test="position() = 1">
          <xsl:call-template name="section-02">
             <xsl:with-param name="header" select="'header'"/>
          </xsl:call-template>
       </xsl:if>
       <xsl:call-template name="section-02"/>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>


The XML section I'm trying to sort looks like this;.
<section-02>
<title>The African American review.</title>
<arrivals>2</arrivals>
</section-02>

<section-02>
<title>Agricultural research /</title>
<arrivals>8</arrivals>
</section-02>

<section-02>
<title>The American biology teacher.</title>
<arrivals>5</arrivals>
</section-02>

<section-02>
<title>The American journal of nursing.</title>
<arrivals>6</arrivals>
</section-02>

<section-02>
<title>Air &amp; space Smithsonian.</title>
<arrivals>2</arrivals>
</section-02>

<section-02>
<title>An American Story.</title>
<arrivals>20</arrivals>
</section-02>



--~------------------------------------------------------------------
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>