Subject: [xsl] sorting and 0 div boolean From: "Susan Campbell" <SCampbell@xxxxxxxxxxxxxxx> Date: Tue, 14 Feb 2006 13:24:06 -0500 |
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@xxxxxxxxxxxxxxx <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 & space Smithsonian.</title> <arrivals>2</arrivals> </section-02> <section-02> <title>An American Story.</title> <arrivals>20</arrivals> </section-02>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Multilanguage help, Kaila Kaarle | Thread | RE: [xsl] sorting and 0 div boolean, Michael Kay |
Re: [xsl] Multilanguage help, António Mota | Date | RE: [xsl] sorting and 0 div boolean, Michael Kay |
Month |