Ok. I have narrowed it down to 2 template rules and can exemplify what is going on without sample test data.

Both rules below match elements with a @class attribute containing 'content_body' and both should have a default priority of 0.5 (by my calculation) because they both entail predicates.

The 1st is more selective than the second though so to give it  precedence I lowered the priority of the second to 0.4 - this works in the version of Saxon that runs in kernow 9.3.0.5

It didn't work in the version I'm running from the command line (as I said I don't remember whether it is 9.4 or 9.5) until I changed the priority of the second template to -0.1. 

This suggests that in the newer version these templates are being given a default of 0 (or 0.25)? Hence by leaving the second template at priority 0.4 it was always being preferred.

Something is definitely wrong here. Hope I have helped pinpoint it.

<xsl:template match="*[contains(@class,'content_body') and descendant::*[@class eq 'media_block_content']]">
    <xsl:apply-templates select="descendant::*[@class eq 'media_block_content']"/>
  </xsl:template> 

  <xsl:template match="*[contains(@class,'content_body')]" priority="0.4">
    <xsl:variable name="link" select="descendant::a[. eq 'Next'][last()]/@href"/>
    <page link="{$link}" reviewsPerPage="{replace($link,'.+limit=(\d+).+','$1')}"/>
  </xsl:template>



On Thu, Dec 12, 2013 at 6:51 PM, Ihe Onwuka <ihe.onwuka@gmail.com> wrote:
Hmmmmmmmm!

Time away from the terminal works wonders. I thought there was no point posting code since the stylesheet worked. But the evidence points to a discrepancy between the version of Saxon in Kernow which is 9.3.0.5 and the version of Saxon I downloaded which is at least 9.4 or was it 9.5?

Since the input is rather large I will send stylesheet and input by private mail.








On Thu, Dec 12, 2013 at 3:10 PM, Michael Kay <mike@saxonica.com> wrote:
Sorry, I know I have said it many times before, but I can't help you debug your code without seeing your code.

Michael Kay
Saxnoica.


On 12 Dec 2013, at 13:27, Ihe Onwuka <ihe.onwuka@gmail.com> wrote:

> Ok this is pretty lame for a problem report but I have to start somewhere.
>
> I am testing my stylesheet in kernow before integrating into a bash shell script.
>
> When I run the stylesheet from kernow I get this output
>
> <?xml version="1.0" encoding="UTF-8"?>
> <metadata>
>    <critic name="glenn abel" agreement="90">
>       <affiliations>
>          <publications>Hollywood Reporter</publications>
>       </affiliations>
>       <totals reviews="23" quickRatings="2"/>
>    </critic>
>    <page link="" reviewsPerPage=""/>
> </metadata>
>
> Running the same stylesheet from the command line I get the following
>
> <metadata>
>    <page link="" reviewsPerPage=""/>
>    <page link="" reviewsPerPage=""/>
> </metadata>
>
> Now I have confirmed (by the insertion of traceable text) that the same stylesheet is being executed in both cases.
>
> This is my command line invocation.
>
> #!/bin/sh
> java -jar $HOME/saxon9he.jar -s:glennabel.xhtml -xsl:getPageCounts.xsl
>
> I have also tried
>
> #!/bin/sh
> cat glennabel.xhtml | java -jar $HOME/saxon9he.jar -s:-  -xsl:getPageCounts.xsl
>
> If I substitute a different stylesheet that runs against the same input and is stored in the same directory I get the right results - that suggests the invocation is ok. Now you'll say it must be the stylesheet but the stylesheet gives the right results when run from kernow.
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk_______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/saxon-help